8000 fix(ui): fix `make dev` (#3795) · navidrome/navidrome@a28462a · GitHub
[go: up one dir, main page]

Skip to content

Commit a28462a

Browse files
authored
fix(ui): fix make dev (#3795)
1. For some bizarre reason, importing inflection by itself is undefined. But you can import specific functions 2. Per vite-pwa/vite-plugin-pwa#419, `type: 'module',` is only for non-chromium browsers
1 parent 5c67297 commit a28462a

File tree

8 files changed

+15
-18
lines changed

8 files changed

+15
-18
lines changed

ui/src/album/AlbumInfo.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import Table from '@material-ui/core/Table'
22
import TableBody from '@material-ui/core/TableBody'
3-
import inflection from 'inflection'
3+
import { humanize, underscore } from 'inflection'
44
import TableCell from '@material-ui/core/TableCell'
55
import TableContainer from '@material-ui/core/TableContainer'
66
import TableRow from '@material-ui/core/TableRow'
@@ -112,7 +112,7 @@ const AlbumInfo = (props) => {
112112
className={classes.tableCell}
113113
>
114114
{translate(`resources.album.fields.${key}`, {
115-
_: inflection.humanize(inflection.underscore(key)),
115+
_: humanize(underscore(key)),
116116
})}
117117
:
118118
</TableCell>

ui/src/album/AlbumList.jsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import albumLists, { defaultAlbumList } from './albumLists'
3131
import config from '../config'
3232
import AlbumInfo from './AlbumInfo'
3333
import ExpandInfoDialog from '../dialogs/ExpandInfoDialog'
34-
import inflection from 'inflection'
34+
import { humanize } from 'inflection'
3535
import { makeStyles } from '@material-ui/core/styles'
3636

3737
const useStyles = makeStyles({
@@ -140,9 +140,7 @@ const AlbumFilter = (props) => {
140140
<AutocompleteInput
141141
emptyText="-- None --"
142142
optionText={(record) =>
143-
record?.tagValue
144-
? inflection.humanize(record?.tagValue)
145-
: '-- None --'
143+
record?.tagValue ? humanize(record?.tagValue) : '-- None --'
146144
}
147145
/>
148146
</ReferenceInput>

ui/src/common/QuickFilter.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react'
22
import { Chip, makeStyles } from '@material-ui/core'
33
import { useTranslate } from 'react-admin'
4-
import inflection from 'inflection'
4+
import { humanize, underscore } from 'inflection'
55

66
const useQuickFilterStyles = makeStyles((theme) => ({
77
chip: {
@@ -16,11 +16,11 @@ export const QuickFilter = ({ source, resource, label, defaultValue }) => {
1616
if (typeof lbl === 'string' || lbl instanceof String) {
1717
if (label) {
1818
lbl = translate(lbl, {
19-
_: inflection.humanize(inflection.underscore(lbl)),
19+
_: humanize(underscore(lbl)),
2020
})
2121
} else {
2222
lbl = translate(`resources.${resource}.fields.${source}`, {
23-
_: inflection.humanize(inflection.underscore(source)),
23+
_: humanize(underscore(source)),
2424
})
2525
}
2626
}

ui/src/common/SongInfo.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import {
1313
useTranslate,
1414
useRecordContext,
1515
} from 'react-admin'
16-
import inflection from 'inflection'
16+
import { humanize, underscore } from 'inflection'
1717
import {
1818
ArtistLinkField,
1919
BitrateField,
@@ -140,7 +140,7 @@ export const SongInfo = (props) => {
140140
<TableRow key={`${record.id}-${key}`}>
141141
<TableCell scope="row" className={classes.tableCell}>
142142
{translate(`resources.song.fields.${key}`, {
143-
_: inflection.humanize(inflection.underscore(key)),
143+
_: humanize(underscore(key)),
144144
})}
145145
:
146146
</TableCell>

ui/src/dialogs/AboutDialog.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import TableRow from '@material-ui/core/TableRow'
1010
import TableCell from '@material-ui/core/TableCell'
1111
import Paper from '@material-ui/core/Paper'
1212
import FavoriteBorderIcon from '@material-ui/icons/FavoriteBorder'
13-
import inflection from 'inflection'
13+
import { humanize, underscore } from 'inflection'
1414
import { useGetOne, usePermissions, useTranslate } from 'react-admin'
1515
import config from '../config'
1616
import { DialogTitle } from './DialogTitle'
@@ -136,7 +136,7 @@ const AboutDialog = ({ open, onClose }) => {
136136
<TableRow key={key}>
137137
<TableCell align="right" component="th" scope="row">
138138
{translate(`about.links.${key}`, {
139-
_: inflection.humanize(inflection.underscore(key)),
139+
_: humanize(underscore(key)),
140140
})}
141141
:
142142
</TableCell>

ui/src/dialogs/HelpDialog.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import TableBody from '@material-ui/core/TableBody'
99
import TableRow from '@material-ui/core/TableRow'
1010
import TableCell from '@material-ui/core/TableCell'
1111
import { useTranslate } from 'react-admin'
12-
import inflection from 'inflection'
12+
import { humanize } from 'inflection'
1313
import { keyMap } from '../hotkeys'
1414
import { DialogTitle } from './DialogTitle'
1515
import { DialogContent } from './DialogContent'
@@ -29,7 +29,7 @@ const HelpTable = (props) => {
2929
{Object.keys(keyMap).map((key) => {
3030
const { sequences, name } = keyMap[key]
3131
const description = translate(`help.hotkeys.${name}`, {
32-
_: inflection.humanize(name),
32+
_: humanize(name),
3333
})
3434
return (
3535
<TableRow key={key}>

ui/src/layout/Menu.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { useTranslate, MenuItemLink, getResources } from 'react-admin'
66
import ViewListIcon from '@material-ui/icons/ViewList'
77
import AlbumIcon from '@material-ui/icons/Album'
88
import SubMenu from './SubMenu'
9-
import inflection from 'inflection'
9+
import { humanize, pluralize } from 'inflection'
1010
import albumLists from '../album/albumLists'
1111
import PlaylistsSubMenu from './PlaylistsSubMenu'
1212
import config from '../config'
@@ -42,7 +42,7 @@ const translatedResourceName = (resource, translate) =>
4242
smart_count: 2,
4343
_: resource.options.label,
4444
})
45-
: inflection.humanize(inflection.pluralize(resource.name)),
45+
: humanize(pluralize(resource.name)),
4646
})
4747

4848
const Menu = ({ dense = false }) => {

ui/vite.config.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ export default defineConfig({
1616
filename: 'sw.js',
1717
devOptions: {
1818
enabled: true,
19-
type: 'module',
2019
},
2120
}),
2221
],

0 commit comments

Comments
 (0)
0