-
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Various smaller improvements for the new frontend (#1567)
* fix: Use FocusTrap on LyricsContainer * refactor: Extract getBestThumbUrl into helper * refactor: Move createStyles into separate .styles files * refactor: Ensure that .styles files end with .ts * refactor: Remove outdated imports * refactor: Extract thumb url creation code * chores: Remove outdated TODOs * fix: Remove markdown from tag tooltip content * feat: Render markdown in comments * chores: Remove outdated TODOs * fix: Use extendedUserLanguageCultures for LyricsTab * perf: Remove decimal.js-light
- Loading branch information
Showing
34 changed files
with
391 additions
and
333 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { PVContract } from '@/types/DataContracts/PVs/PVContract'; | ||
|
||
const PREFERRED_SERVICES = ['Youtube', 'NicoNicoDouga', 'Bilibili', 'Vimeo']; | ||
|
||
export const getBestThumbUrl = (pvs: PVContract[] | undefined): string | undefined => { | ||
if (pvs === undefined) { | ||
return undefined; | ||
} | ||
|
||
return pvs | ||
.filter((pv) => !pv.disabled && pv.url !== undefined) | ||
.reduce((currPV: PVContract | undefined, nextPV) => { | ||
const currPos = PREFERRED_SERVICES.indexOf(currPV?.service ?? ''); | ||
const nextPos = PREFERRED_SERVICES.indexOf(nextPV.service ?? ''); | ||
if ( | ||
currPV === undefined || | ||
(PREFERRED_SERVICES.includes(nextPV.service) && nextPos < currPos) | ||
) { | ||
return nextPV; | ||
} | ||
return currPV; | ||
}, undefined)?.url; | ||
}; | ||
|
||
export const getBestThumbImageUrl = (pvs: PVContract[] | undefined): string => { | ||
const bestThumbUrl = getBestThumbUrl(pvs); | ||
|
||
return bestThumbUrl === undefined | ||
? `/unknown.webp` | ||
: `/api/pvs/thumbnail?pvUrl=${bestThumbUrl}`; | ||
}; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { createStyles } from '@mantine/core'; | ||
|
||
export const useStyles = createStyles((theme) => ({ | ||
box: { | ||
padding: theme.spacing.md, | ||
position: 'relative', | ||
height: 'calc(100vh - 70px - 64px)', | ||
overflowY: 'scroll', | ||
[theme.fn.smallerThan('sm')]: { | ||
height: 'calc(100vh - 50px - 64px)', | ||
}, | ||
}, | ||
})); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
VocaDbWeb/New/components/AppShell/CollapsibleLinkGroup.styles.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { createStyles, rem } from '@mantine/core'; | ||
|
||
export const useStyles = createStyles((theme) => ({ | ||
control: { | ||
display: 'block', | ||
width: '100%', | ||
padding: `${theme.spacing.xs} `, | ||
color: theme.colorScheme === 'dark' ? theme.colors.dark[0] : theme.black, | ||
fontSize: theme.fontSizes.sm, | ||
|
||
'&:hover': { | ||
backgroundColor: | ||
theme.colorScheme === 'dark' ? theme.colors.dark[6] : theme.colors.gray[0], | ||
}, | ||
}, | ||
|
||
link: { | ||
display: 'block', | ||
padding: `${theme.spacing.xs}`, | ||
paddingLeft: rem(31), | ||
marginLeft: rem(30), | ||
fontSize: theme.fontSizes.sm, | ||
color: theme.colorScheme === 'dark' ? theme.colors.dark[0] : theme.colors.gray[7], | ||
borderLeft: `${rem(1)} solid ${ | ||
theme.colorScheme === 'dark' ? theme.colors.dark[4] : theme.colors.gray[3] | ||
}`, | ||
|
||
'&:hover': { | ||
backgroundColor: | ||
theme.colorScheme === 'dark' ? theme.colors.dark[6] : theme.colors.gray[0], | ||
}, | ||
}, | ||
iconWrapper: { | ||
display: 'flex', | ||
alignItems: 'center', | ||
}, | ||
})); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { createStyles, rem } from '@mantine/core'; | ||
|
||
export const useStyles = createStyles((theme) => ({ | ||
base: { | ||
position: 'fixed', | ||
height: 65, | ||
right: 0, | ||
bottom: 0, | ||
left: 300, | ||
[theme.fn.smallerThan('lg')]: { | ||
left: 220, | ||
}, | ||
[theme.fn.smallerThan('sm')]: { | ||
left: 0, | ||
}, | ||
borderTop: `${rem(1)} solid ${ | ||
theme.colorScheme === 'dark' ? theme.colors.dark[4] : theme.colors.gray[3] | ||
}`, | ||
}, | ||
footer: { | ||
display: 'flex', | ||
flexDirection: 'row', | ||
justifyContent: 'space-between', | ||
height: '100%', | ||
}, | ||
})); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import { createStyles } from '@mantine/core'; | ||
|
||
export const useStyles = createStyles((theme) => ({ | ||
header: { | ||
display: 'flex', | ||
justifyContent: 'space-between', | ||
}, | ||
|
||
image: { | ||
objectFit: 'contain', | ||
height: '100%', | ||
}, | ||
|
||
rightSectionWrapper: { | ||
display: 'flex', | ||
alignItems: 'center', | ||
height: '100%', | ||
}, | ||
|
||
burger: { | ||
[theme.fn.largerThan('sm')]: { | ||
display: 'none', | ||
}, | ||
}, | ||
})); | ||
|
Oops, something went wrong.