From 5570c859740a1860a2179783dd34795657d84fbb Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Tue, 9 Jun 2026 22:04:39 -0400 Subject: [PATCH] CustomSounds: Fix CSS --- .../customSounds/SoundOverrideComponent.tsx | 126 +++++++++--------- src/equicordplugins/customSounds/index.tsx | 13 +- src/equicordplugins/customSounds/styles.css | 8 +- 3 files changed, 79 insertions(+), 68 deletions(-) diff --git a/src/equicordplugins/customSounds/SoundOverrideComponent.tsx b/src/equicordplugins/customSounds/SoundOverrideComponent.tsx index 8820fd6ba..85c7e89a6 100644 --- a/src/equicordplugins/customSounds/SoundOverrideComponent.tsx +++ b/src/equicordplugins/customSounds/SoundOverrideComponent.tsx @@ -5,6 +5,7 @@ */ import { AudioPlayerInterface, playAudio } from "@api/AudioPlayer"; +import { Button } from "@components/Button"; import { Card } from "@components/Card"; import { FormSwitch } from "@components/FormSwitch"; import { Heading } from "@components/Heading"; @@ -13,7 +14,7 @@ import { Margins } from "@utils/margins"; import { useForceUpdater } from "@utils/react"; import { makeRange } from "@utils/types"; import { findLazy } from "@webpack"; -import { Button, React, Select, showToast, Slider } from "@webpack/common"; +import { React, Select, showToast, Slider } from "@webpack/common"; import { ComponentType, Ref, SyntheticEvent } from "react"; import { deleteAudio, getAllAudio, saveAudio, StoredAudioFile } from "./audioStore"; @@ -177,100 +178,103 @@ export function SoundOverrideComponent({ type, override, onChange }: { {override.enabled && ( <> -
+
- Volume - { - sound.current && (sound.current.volume = val); - override.volume = val; - saveAndNotify(); - }} - className={Margins.bottom16} - disabled={!override.enabled} - /> +
+ Volume + { + sound.current && (sound.current.volume = val); + override.volume = val; + saveAndNotify(); + }} + disabled={!override.enabled} + /> +
- Sound Source - ({ value: id, label: capitalizeWords(id) })) ?? []), + { value: "custom", label: "Custom" } + ]} + isSelected={v => v === override.selectedSound} + select={async v => { + override.selectedSound = v; - if (v === "custom" && override.selectedFileId) { - try { - await ensureDataURICached(override.selectedFileId); - } catch (error) { - console.error(`[CustomSounds] Failed to cache data URI for ${type.id}:`, error); - showToast("Error loading custom sound file"); + if (v === "custom" && override.selectedFileId) { + try { + await ensureDataURICached(override.selectedFileId); + } catch (error) { + console.error(`[CustomSounds] Failed to cache data URI for ${type.id}:`, error); + showToast("Error loading custom sound file"); + } } - } - await saveAndNotify(); - }} - serialize={opt => opt.value} - className={Margins.bottom16} - /> + await saveAndNotify(); + }} + serialize={opt => opt.value} + /> +
{override.selectedSound === "custom" && ( <> - Custom File - v === (override.selectedFileId || "")} + select={async id => { + if (!id) { + override.selectedFileId = undefined; + } else { + override.selectedFileId = id; + await ensureDataURICached(id); + } - await saveAndNotify(); - }} - serialize={opt => opt.value} - className={Margins.bottom8} - /> + await saveAndNotify(); + }} + serialize={opt => opt.value} + /> + -
+
{override.selectedFileId && files[override.selectedFileId] && ( - - - + + + +
diff --git a/src/equicordplugins/customSounds/styles.css b/src/equicordplugins/customSounds/styles.css index e3c9f2ef1..f6d1d8444 100644 --- a/src/equicordplugins/customSounds/styles.css +++ b/src/equicordplugins/customSounds/styles.css @@ -54,6 +54,12 @@ gap: 16px; } -.vc-custom-sounds-preview-controls { +.vc-custom-sounds-override-controls { display: flex; + gap: 8px; + margin-bottom: 16px; +} + +.vc-custom-sounds-file-input { + display: none; } \ No newline at end of file