RosePlugs: remove the competing row-tap detail sheet
This commit is contained in:
parent
a42d97decb
commit
6cc4b6eb52
2 changed files with 0 additions and 53 deletions
|
|
@ -1,50 +0,0 @@
|
||||||
import { React, ReactNative } from "@vendetta/metro/common";
|
|
||||||
import { plugins as installedPlugins, installPlugin } from "@vendetta/plugins";
|
|
||||||
import { showToast } from "@vendetta/ui/toasts";
|
|
||||||
import PrimaryButton from "@shared/ui/PrimaryButton";
|
|
||||||
import { NexusPlugin } from "../lib/nexusApi";
|
|
||||||
|
|
||||||
const { ScrollView, Text } = ReactNative;
|
|
||||||
|
|
||||||
// Confirmed live: this could get stuck on "Installing..." forever - the timeout below is a safety
|
|
||||||
// net so a hung installPlugin() call can't leave the button stuck indefinitely.
|
|
||||||
function withTimeout<T>(promise: Promise<T>, ms: number): Promise<T> {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
const timer = setTimeout(() => reject(new Error("Timed out")), ms);
|
|
||||||
promise.then(
|
|
||||||
(v) => { clearTimeout(timer); resolve(v); },
|
|
||||||
(e) => { clearTimeout(timer); reject(e); },
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function PluginDetailSheet({ plugin }: { plugin: NexusPlugin }) {
|
|
||||||
const [installing, setInstalling] = React.useState(false);
|
|
||||||
const alreadyInstalled = plugin.installUrl in installedPlugins;
|
|
||||||
|
|
||||||
const onInstall = React.useCallback(() => {
|
|
||||||
setInstalling(true);
|
|
||||||
withTimeout(installPlugin(plugin.installUrl), 20000)
|
|
||||||
.then(() => showToast(`${plugin.name} installed`))
|
|
||||||
.catch((e: any) => showToast(`Install failed: ${e?.message ?? e}`))
|
|
||||||
.finally(() => setInstalling(false));
|
|
||||||
}, [plugin.installUrl]);
|
|
||||||
|
|
||||||
return (
|
|
||||||
<ScrollView style={{ maxHeight: 400, padding: 16 }}>
|
|
||||||
<Text style={{ fontSize: 18, fontWeight: "700", marginBottom: 8 }}>{plugin.name}</Text>
|
|
||||||
<Text style={{ fontSize: 13, opacity: 0.8, marginBottom: 4 }}>{plugin.category}</Text>
|
|
||||||
<Text style={{ fontSize: 14, marginBottom: 16 }}>{plugin.tagline || plugin.description}</Text>
|
|
||||||
{plugin.status && plugin.status !== "default" && (
|
|
||||||
<Text style={{ fontSize: 12, fontWeight: "700", marginBottom: 16 }}>
|
|
||||||
{plugin.status.toUpperCase()}
|
|
||||||
</Text>
|
|
||||||
)}
|
|
||||||
<PrimaryButton
|
|
||||||
label={alreadyInstalled ? "Installed" : installing ? "Installing…" : "Install"}
|
|
||||||
disabled={alreadyInstalled || installing}
|
|
||||||
onPress={onInstall}
|
|
||||||
/>
|
|
||||||
</ScrollView>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
@ -1,13 +1,11 @@
|
||||||
import { React, ReactNative } from "@vendetta/metro/common";
|
import { React, ReactNative } from "@vendetta/metro/common";
|
||||||
import { plugins as installedPlugins, installPlugin } from "@vendetta/plugins";
|
import { plugins as installedPlugins, installPlugin } from "@vendetta/plugins";
|
||||||
import { showCustomAlert } from "@vendetta/ui/alerts";
|
|
||||||
import { showToast } from "@vendetta/ui/toasts";
|
import { showToast } from "@vendetta/ui/toasts";
|
||||||
import SettingsScaffold from "@shared/ui/SettingsScaffold";
|
import SettingsScaffold from "@shared/ui/SettingsScaffold";
|
||||||
import NoteBox from "@shared/ui/NoteBox";
|
import NoteBox from "@shared/ui/NoteBox";
|
||||||
import PrimaryButton from "@shared/ui/PrimaryButton";
|
import PrimaryButton from "@shared/ui/PrimaryButton";
|
||||||
import { TableRow, TableRowGroup } from "@shared/ui/table";
|
import { TableRow, TableRowGroup } from "@shared/ui/table";
|
||||||
import { fetchNexusPlugins, NexusPlugin } from "../lib/nexusApi";
|
import { fetchNexusPlugins, NexusPlugin } from "../lib/nexusApi";
|
||||||
import PluginDetailSheet from "./PluginDetailSheet";
|
|
||||||
|
|
||||||
const { Text, View, TouchableOpacity } = ReactNative;
|
const { Text, View, TouchableOpacity } = ReactNative;
|
||||||
|
|
||||||
|
|
@ -117,7 +115,6 @@ export default function PluginsBrowser() {
|
||||||
)}
|
)}
|
||||||
</View>
|
</View>
|
||||||
}
|
}
|
||||||
onPress={() => showCustomAlert(PluginDetailSheet, { plugin })}
|
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue