diff --git a/src/equicordplugins/customSounds/components/SoundOverrideComponent.tsx b/src/equicordplugins/customSounds/components/SoundOverrideComponent.tsx index 4ed903f3..4519955c 100644 --- a/src/equicordplugins/customSounds/components/SoundOverrideComponent.tsx +++ b/src/equicordplugins/customSounds/components/SoundOverrideComponent.tsx @@ -5,21 +5,21 @@ */ import { classNameFactory } from "@api/Styles"; -import { makeRange } from "@components/PluginSettings/components"; import { Margins } from "@utils/margins"; import { classes } from "@utils/misc"; import { useForceUpdater } from "@utils/react"; import { findByCodeLazy, findLazy } from "@webpack"; -import { Button, Card, Forms, Slider, Switch, useRef } from "@webpack/common"; +import { Button, Card, Forms, Slider, Switch, Tooltip, useRef } from "@webpack/common"; import { ComponentType, Ref, SyntheticEvent } from "react"; import { SoundOverride, SoundPlayer, SoundType } from "../types"; type FileInput = ComponentType<{ ref: Ref; - onChange: (e: SyntheticEvent) => void; + onChange: (event: SyntheticEvent) => void; multiple?: boolean; filters?: { name?: string; extensions: string[]; }[]; + disabled?: boolean; }>; const playSound: (id: string) => SoundPlayer = findByCodeLazy(".playWithListener().then"); @@ -43,8 +43,72 @@ export function SoundOverrideComponent({ type, override, onChange }: { type: Sou className={Margins.bottom16} hideBorder={true} > - {type.name} ({type.id}) + + {tooltipProps => {type.name}} + + Sound File +
+ {override.url.length === 0 ? "Discord Default" : (override.fileName || "Custom Sound")} + + +
+ Volume + { + override.volume = value; + onChange(); + update(); + }} + className={Margins.bottom16} + disabled={!override.enabled} + /> - Replacement Sound - - - Volume - { - override.volume = value; - onChange(); - update(); - }} - className={Margins.bottom16} - disabled={!override.enabled} - /> ); } diff --git a/src/equicordplugins/customSounds/styles.css b/src/equicordplugins/customSounds/styles.css index 84270449..f5ece128 100644 --- a/src/equicordplugins/customSounds/styles.css +++ b/src/equicordplugins/customSounds/styles.css @@ -2,10 +2,17 @@ padding: 1em 1em 0; } -.vc-custom-sounds-id { - color: var(--text-muted); +.vc-custom-sounds-file { + display: flex; + align-items: center; + gap: 0.5em; } -.vc-custom-sounds-upload { +.vc-custom-sounds-file-name { + flex-grow: 1; +} + +.vc-custom-sounds-file-replace, +.vc-custom-sounds-file-reset { display: inline; } diff --git a/src/equicordplugins/customSounds/types.ts b/src/equicordplugins/customSounds/types.ts index adbb270e..9bb76e0d 100644 --- a/src/equicordplugins/customSounds/types.ts +++ b/src/equicordplugins/customSounds/types.ts @@ -11,6 +11,7 @@ export interface SoundType { export interface SoundOverride { enabled: boolean; + fileName: string; url: string; volume: number; } @@ -51,6 +52,7 @@ export const soundTypes: readonly SoundType[] = [ export function makeEmptyOverride(): SoundOverride { return { enabled: false, + fileName: "", url: "", volume: 100 };