restructure files onto electron-vite boilerplate

This commit is contained in:
jeffvli 2025-05-18 14:03:18 -07:00
parent 91ce2cd8a1
commit 1cf587bc8f
457 changed files with 9927 additions and 11705 deletions

View file

@ -1,8 +1,10 @@
import type { Album, AlbumArtist, Song } from '/@/renderer/api/types';
import dayjs from 'dayjs';
import relativeTime from 'dayjs/plugin/relativeTime';
import utc from 'dayjs/plugin/utc';
import formatDuration from 'format-duration';
import type { Album, AlbumArtist, Song } from '/@/renderer/api/types';
import { Rating } from '/@/renderer/components/rating';
dayjs.extend(relativeTime);
@ -19,13 +21,13 @@ const getDateFormat = (key: string): string => {
return FORMATS[dashes];
};
export const formatDateAbsolute = (key: string | null) =>
export const formatDateAbsolute = (key: null | string) =>
key ? dayjs(key).format(getDateFormat(key)) : '';
export const formatDateAbsoluteUTC = (key: string | null) =>
export const formatDateAbsoluteUTC = (key: null | string) =>
key ? dayjs.utc(key).format(getDateFormat(key)) : '';
export const formatDateRelative = (key: string | null) => (key ? dayjs(key).fromNow() : '');
export const formatDateRelative = (key: null | string) => (key ? dayjs(key).fromNow() : '');
export const formatDurationString = (duration: number) => {
const rawDuration = formatDuration(duration).split(':');

View file

@ -1,10 +1,10 @@
export * from './random-string';
export * from './normalize-server-url';
export * from './set-local-storage-setttings';
export * from './constrain-sidebar-width';
export * from './title-case';
export * from './format';
export * from './get-header-color';
export * from './normalize-server-url';
export * from './parse-search-params';
export * from './random-string';
export * from './rgb-to-rgba';
export * from './sentence-case';
export * from './format';
export * from './set-local-storage-setttings';
export * from './title-case';

View file

@ -19,8 +19,8 @@ export const replaceURLWithHTMLLinks = (text: string) => {
const prefix = link.startsWith('http') ? '' : 'https://';
elements.push(
<a
key={lastIndex}
href={prefix + link}
key={lastIndex}
rel="noopener noreferrer"
target="_blank"
>

View file

@ -1,9 +1,11 @@
import isElectron from 'is-electron';
import { getServerById, PlayerData, useSettingsStore } from '/@/renderer/store';
import type { QueueSong } from '/@/renderer/api/types';
import { api } from '/@/renderer/api';
const mpvPlayer = isElectron() ? window.electron.mpvPlayer : null;
import isElectron from 'is-electron';
import { api } from '/@/renderer/api';
import { getServerById, PlayerData, useSettingsStore } from '/@/renderer/store';
const mpvPlayer = isElectron() ? window.api.mpvPlayer : null;
const modifyUrl = (song: QueueSong): string => {
const transcode = useSettingsStore.getState().playback.transcode;