From 1285f0220b49be53443b632afdddb022f44426ed Mon Sep 17 00:00:00 2001 From: kmmiio99o <164557248+kmmiio99o@users.noreply.github.com> Date: Fri, 19 Sep 2025 20:25:22 +0200 Subject: [PATCH] I TRIED SO HARD --- plugins/Last.fm/src/ui/ChangelogView.tsx | 109 +++++--- plugins/Last.fm/src/ui/pages/Settings.tsx | 322 +++++++++------------- 2 files changed, 198 insertions(+), 233 deletions(-) diff --git a/plugins/Last.fm/src/ui/ChangelogView.tsx b/plugins/Last.fm/src/ui/ChangelogView.tsx index 3492d7a..e8422cd 100644 --- a/plugins/Last.fm/src/ui/ChangelogView.tsx +++ b/plugins/Last.fm/src/ui/ChangelogView.tsx @@ -1,49 +1,80 @@ import { clipboard } from "@vendetta/metro/common"; import { getAssetIDByName } from "@vendetta/ui/assets"; -import { ErrorBoundary, Forms, General } from "@vendetta/ui/components"; +import { Forms, General } from "@vendetta/ui/components"; import { showToast } from "@vendetta/ui/toasts"; import { changelog, currentVersion } from "../changelog"; import { React } from "@vendetta/metro/common"; +import { findByProps } from "@vendetta/metro"; -const { FormRow, FormSection } = Forms; -const { View, ScrollView, Text, TouchableOpacity } = General; +const { TableRowGroup, TableRow, Stack } = findByProps( + "TableSwitchRow", + "TableRowGroup", + "Stack", + "TableRow", +); +const { ScrollView } = General; export default function ChangelogView() { - return ( - - - - { - clipboard.setString(currentVersion); - showToast("Version copied to clipboard", getAssetIDByName("toast_copy_link")); - }} - > - Copy - - } - /> - + return ( + + + + { + clipboard.setString(currentVersion); + showToast( + "Version copied to clipboard", + getAssetIDByName("toast_copy_link"), + ); + }} + > + + Copy + + + } + /> + - - {changelog.map((entry, index) => ( - - - Version {entry.version} - {entry.date} - - {entry.changes.map((change, changeIndex) => ( - - • {change} - - ))} - - ))} - - - - ); + + {changelog.map((entry, index) => ( + + + + Version {entry.version} + + + {entry.date} + + + {entry.changes.map((change, changeIndex) => ( + + • {change} + + ))} + + ))} + + + + ); } diff --git a/plugins/Last.fm/src/ui/pages/Settings.tsx b/plugins/Last.fm/src/ui/pages/Settings.tsx index 99f9989..1832f68 100644 --- a/plugins/Last.fm/src/ui/pages/Settings.tsx +++ b/plugins/Last.fm/src/ui/pages/Settings.tsx @@ -6,15 +6,21 @@ import { showToast } from "@vendetta/ui/toasts"; import { React } from "@vendetta/metro/common"; import { ScrollView, View, Linking } from "react-native"; import { changelog, currentVersion } from "../../changelog"; +import { findByProps } from "@vendetta/metro"; + +const { TableRowGroup, TableSwitchRow, Stack, TableRow } = findByProps( + "TableSwitchRow", + "TableRowGroup", + "Stack", + "TableRow", +); +const { TextInput } = findByProps("TextInput"); import { currentSettings, pluginState } from "../.."; import Constants from "../../constants"; import { initialize } from "../../manager"; import { lastfmClient } from "../../utils/lastfm"; -const { FormInput, FormRow, FormSwitch, FormSection, FormDivider, FormText } = - Forms; - export default function Settings() { useProxy(currentSettings); @@ -50,202 +56,130 @@ export default function Settings() { }; return ( - - - saveSettings("username", value)} - /> - - saveSettings("apiKey", value)} - secureTextEntry={true} - /> - - Get your API key at: https://www.last.fm/api/account/create - - } - trailing={loading ? : } - onPress={testConnection} - disabled={loading} - /> - - - - saveSettings("appName", value)} - /> - - { - const interval = Number(value); - if (interval >= Constants.MIN_UPDATE_INTERVAL) { - saveSettings("timeInterval", interval); - } else { - showToast( - `Minimum interval is ${Constants.MIN_UPDATE_INTERVAL} seconds`, - getAssetIDByName("Small"), - ); - } - }} - keyboardType="numeric" - /> - - - - } - trailing={ - - saveSettings("listeningTo", value) + + + + + saveSettings("username", value)} + /> + saveSettings("apiKey", value)} + secureTextEntry={true} + /> + + Linking.openURL("https://www.last.fm/api/account/create") } /> - } - /> - - } - trailing={ - - saveSettings("showTimestamp", value) - } - /> - } - /> - - - } - trailing={ - - saveSettings("ignoreSpotify", value) - } - /> - } - /> - - - } - trailing={ - - saveSettings("verboseLogging", value) - } - /> - } - /> - + + : } + onPress={testConnection} + disabled={loading} + /> + - - - - Status: {pluginState.pluginStopped ? "Stopped" : "Running"} - - - Last Update:{" "} - {pluginState.lastTrackUrl ? "Success" : "No track data"} - - - - - - } - trailing={} - onPress={() => { - Linking.openURL(Constants.GITHUB_COMMITS_URL); - }} - /> - - {changelog.map((entry, index) => ( - - + + saveSettings("appName", value)} + /> + { + const interval = Number(value); + if (interval >= Constants.MIN_UPDATE_INTERVAL) { + saveSettings("timeInterval", interval); + } else { + showToast( + `Minimum interval is ${Constants.MIN_UPDATE_INTERVAL} seconds`, + getAssetIDByName("Small"), + ); + } }} - > - - Version {entry.version} - - {entry.date} - - {entry.changes.map((change, changeIndex) => ( - - • {change} - - ))} - - ))} - + keyboardType="numeric" + /> + + - - Version {currentVersion} - + + + saveSettings("listeningTo", value) + } + /> + + saveSettings("showTimestamp", value) + } + /> + + saveSettings("ignoreSpotify", value) + } + /> + + saveSettings("verboseLogging", value) + } + /> + + + + + + + + + + } + onPress={() => { + // You might want to implement a navigation to your ChangelogView here + // For now, we'll open the GitHub URL + Linking.openURL(Constants.GITHUB_COMMITS_URL); + }} + /> + + ); }