mirror of
https://github.com/antebudimir/feishin.git
synced 2026-01-01 02:13:33 +00:00
restructure files onto electron-vite boilerplate
This commit is contained in:
parent
91ce2cd8a1
commit
1cf587bc8f
457 changed files with 9927 additions and 11705 deletions
|
|
@ -1,11 +1,13 @@
|
|||
import { forwardRef, ReactNode, Ref, useCallback, useState } from 'react';
|
||||
import { Center, Group } from '@mantine/core';
|
||||
import { closeAllModals, openModal } from '@mantine/modals';
|
||||
import { AutoTextSize } from 'auto-text-size';
|
||||
import clsx from 'clsx';
|
||||
import { forwardRef, ReactNode, Ref, useCallback, useState } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { Link } from 'react-router-dom';
|
||||
import styles from './library-header.module.scss';
|
||||
|
||||
import styles from './library-header.module.css';
|
||||
|
||||
import { LibraryItem } from '/@/renderer/api/types';
|
||||
import { Text } from '/@/renderer/components';
|
||||
import { ItemImagePlaceholder } from '/@/renderer/features/shared/components/item-image-placeholder';
|
||||
|
|
@ -15,8 +17,8 @@ interface LibraryHeaderProps {
|
|||
background: string;
|
||||
blur?: number;
|
||||
children?: ReactNode;
|
||||
imagePlaceholderUrl?: string | null;
|
||||
imageUrl?: string | null;
|
||||
imagePlaceholderUrl?: null | string;
|
||||
imageUrl?: null | string;
|
||||
item: { route: string; type: LibraryItem };
|
||||
title: string;
|
||||
}
|
||||
|
|
@ -24,13 +26,13 @@ interface LibraryHeaderProps {
|
|||
export const LibraryHeader = forwardRef(
|
||||
(
|
||||
{
|
||||
imageUrl,
|
||||
imagePlaceholderUrl,
|
||||
background,
|
||||
blur,
|
||||
title,
|
||||
item,
|
||||
children,
|
||||
imagePlaceholderUrl,
|
||||
imageUrl,
|
||||
item,
|
||||
title,
|
||||
}: LibraryHeaderProps,
|
||||
ref: Ref<HTMLDivElement>,
|
||||
) => {
|
||||
|
|
@ -46,10 +48,10 @@ export const LibraryHeader = forwardRef(
|
|||
switch (item.type) {
|
||||
case LibraryItem.ALBUM:
|
||||
return t('entity.album', { count: 1 });
|
||||
case LibraryItem.ARTIST:
|
||||
return t('entity.artist', { count: 1 });
|
||||
case LibraryItem.ALBUM_ARTIST:
|
||||
return t('entity.albumArtist', { count: 1 });
|
||||
case LibraryItem.ARTIST:
|
||||
return t('entity.artist', { count: 1 });
|
||||
case LibraryItem.PLAYLIST:
|
||||
return t('entity.playlist', { count: 1 });
|
||||
case LibraryItem.SONG:
|
||||
|
|
@ -66,12 +68,12 @@ export const LibraryHeader = forwardRef(
|
|||
openModal({
|
||||
children: (
|
||||
<Center
|
||||
onClick={() => closeAllModals()}
|
||||
style={{
|
||||
cursor: 'pointer',
|
||||
height: 'calc(100vh - 80px)',
|
||||
width: '100%',
|
||||
}}
|
||||
onClick={() => closeAllModals()}
|
||||
>
|
||||
<img
|
||||
alt="cover"
|
||||
|
|
@ -90,8 +92,8 @@ export const LibraryHeader = forwardRef(
|
|||
|
||||
return (
|
||||
<div
|
||||
ref={ref}
|
||||
className={styles.libraryHeader}
|
||||
ref={ref}
|
||||
>
|
||||
<div
|
||||
className={styles.background}
|
||||
|
|
@ -104,22 +106,22 @@ export const LibraryHeader = forwardRef(
|
|||
/>
|
||||
<div
|
||||
className={styles.imageSection}
|
||||
onClick={() => openImage()}
|
||||
onKeyDown={(event) =>
|
||||
[' ', 'Enter', 'Spacebar'].includes(event.key) && openImage()
|
||||
}
|
||||
role="button"
|
||||
style={{ cursor: 'pointer' }}
|
||||
tabIndex={0}
|
||||
onClick={() => openImage()}
|
||||
onKeyDown={(event) =>
|
||||
['Spacebar', ' ', 'Enter'].includes(event.key) && openImage()
|
||||
}
|
||||
>
|
||||
{imageUrl && !isImageError ? (
|
||||
<img
|
||||
alt="cover"
|
||||
className={styles.image}
|
||||
onError={onImageError}
|
||||
placeholder={imagePlaceholderUrl || 'var(--placeholder-bg)'}
|
||||
src={imageUrl}
|
||||
style={{ height: '' }}
|
||||
onError={onImageError}
|
||||
/>
|
||||
) : (
|
||||
<ItemImagePlaceholder itemType={item.type} />
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue