diff --git a/plugins/Commands/settings.tsx b/plugins/Commands/settings.tsx index 9b74137..df79390 100644 --- a/plugins/Commands/settings.tsx +++ b/plugins/Commands/settings.tsx @@ -162,7 +162,7 @@ function FactsSettingsPage({ forceRerender }: { forceRerender: () => void }) { /> - + void }) { ); } -// Gary API Settings Page - FIXED VERSION +// REFACTORED Gary API Settings Page with better switches function GaryAPIPage({ forceRerender }: { forceRerender: () => void }) { - useProxy(storage); // Add this to make the component reactive to storage changes + useProxy(storage); const styles = stylesheet.createThemedStyleSheet({ container: { flex: 1, backgroundColor: semanticColors.BACKGROUND_PRIMARY, }, - optionContainer: { - flexDirection: "row", - alignItems: "center", - paddingVertical: 16, - paddingHorizontal: 16, - backgroundColor: semanticColors.CARD_PRIMARY_BG, - borderRadius: 12, - marginHorizontal: 16, - marginVertical: 4, - }, - selectedOption: { - backgroundColor: semanticColors.BRAND_500_ALPHA || `${semanticColors.BRAND_500}20`, - borderColor: semanticColors.BRAND_500, - borderWidth: 2, - }, - normalOption: { - borderColor: semanticColors.BORDER_FAINT, - borderWidth: 1, - }, - radioButton: { - width: 20, - height: 20, - borderRadius: 10, - borderWidth: 2, - borderColor: semanticColors.TEXT_MUTED, - alignItems: "center", - justifyContent: "center", - marginRight: 12, - }, - selectedRadio: { - borderColor: semanticColors.BRAND_500, - }, - radioInner: { - width: 10, - height: 10, - borderRadius: 5, - backgroundColor: semanticColors.BRAND_500, - }, - textContainer: { - flex: 1, - }, - optionTitle: { - fontSize: 16, - fontWeight: "600", - color: semanticColors.TEXT_NORMAL, // Fixed: always use TEXT_NORMAL - }, - optionDesc: { - fontSize: 14, - color: semanticColors.TEXT_MUTED, - marginTop: 2, - }, infoText: { fontSize: 14, color: semanticColors.TEXT_MUTED, @@ -276,35 +225,14 @@ function GaryAPIPage({ forceRerender }: { forceRerender: () => void }) { }, }); - const options = [ - { - value: "gary", - title: "Gary API", - desc: "Original Gary the cat images from api.garythe.cat", - icon: getAssetIDByName("ic_cat") - }, - { - value: "catapi", - title: "Cat API", - desc: "Random cat pictures from thecatapi.com", - icon: getAssetIDByName("ic_cat") - }, - { - value: "minker", - title: "Minker API", - desc: "Minky images from minky.materii.dev", - icon: getAssetIDByName("ImageIcon") - }, - { - value: "goober", - title: "Goober API", - desc: "Goober images from api.garythe.cat/goober", - icon: getAssetIDByName("ImageIcon") - }, - ]; - const currentSource = storage.garySettings?.imageSource || "gary"; + const handleSourceChange = (newSource: string) => { + console.log(`[Gary Settings] Changing from ${currentSource} to ${newSource}`); + storage.garySettings.imageSource = newSource; + forceRerender(); + }; + return ( @@ -328,48 +256,36 @@ function GaryAPIPage({ forceRerender }: { forceRerender: () => void }) { - {options.map((option) => { - const isSelected = currentSource === option.value; - return ( - { - console.log(`[Settings] Changing Gary API from ${currentSource} to: ${option.value}`); - storage.garySettings.imageSource = option.value; - // Force immediate update - forceRerender(); - }} - > - - {isSelected && } - - - - - {option.title} - - - {option.desc} - - - - ); - })} + + } + value={currentSource === "gary"} + onValueChange={(v) => v && handleSourceChange("gary")} + /> + } + value={currentSource === "catapi"} + onValueChange={(v) => v && handleSourceChange("catapi")} + /> + } + value={currentSource === "minker"} + onValueChange={(v) => v && handleSourceChange("minker")} + /> + } + value={currentSource === "goober"} + onValueChange={(v) => v && handleSourceChange("goober")} + /> + @@ -421,7 +337,7 @@ function ListSettingsPage({ forceRerender }: { forceRerender: () => void }) { /> - + void }) { ); } -// NEW: Separate Spotify Commands Settings Page +// FIXED Spotify Commands Settings Page function SpotifySettingsPage({ forceRerender }: { forceRerender: () => void }) { const styles = stylesheet.createThemedStyleSheet({ container: { flex: 1, backgroundColor: semanticColors.BACKGROUND_PRIMARY, }, + infoText: { + fontSize: 14, + color: semanticColors.TEXT_MUTED, // FIXED: Use semantic color + textAlign: "center", + lineHeight: 20, + }, }); return ( - + } + leading={} value={storage.enabledCommands?.spotifyTrack ?? true} onValueChange={(v) => { storage.enabledCommands.spotifyTrack = v; @@ -532,7 +454,7 @@ function SpotifySettingsPage({ forceRerender }: { forceRerender: () => void }) { } + leading={} value={storage.enabledCommands?.spotifyAlbum ?? true} onValueChange={(v) => { storage.enabledCommands.spotifyAlbum = v; @@ -543,7 +465,7 @@ function SpotifySettingsPage({ forceRerender }: { forceRerender: () => void }) { } + leading={} value={storage.enabledCommands?.spotifyArtists ?? true} onValueChange={(v) => { storage.enabledCommands.spotifyArtists = v; @@ -554,7 +476,7 @@ function SpotifySettingsPage({ forceRerender }: { forceRerender: () => void }) { } + leading={} value={storage.enabledCommands?.spotifyCover ?? true} onValueChange={(v) => { storage.enabledCommands.spotifyCover = v; @@ -565,12 +487,7 @@ function SpotifySettingsPage({ forceRerender }: { forceRerender: () => void }) { - + These commands allow you to share your current Spotify activity in Discord. Make sure you have Spotify connected to Discord for these commands to work properly. @@ -579,7 +496,7 @@ function SpotifySettingsPage({ forceRerender }: { forceRerender: () => void }) { ); } -// Other Commands Settings Page - UPDATED (removed Spotify) +// Other Commands Settings Page function OtherSettingsPage({ forceRerender }: { forceRerender: () => void }) { const styles = stylesheet.createThemedStyleSheet({ container: { @@ -810,18 +727,18 @@ export default function Settings() {
{/* Command Categories */} - + } + leading={} trailing={} onPress={() => navigateToPage("Facts Commands", FactsSettingsPage)} /> } + leading={} trailing={} onPress={() => navigateToPage("List Commands", ListSettingsPage)} /> @@ -845,7 +762,7 @@ export default function Settings() { } + leading={} trailing={} onPress={() => navigateToPage("Spotify Commands", SpotifySettingsPage)} />