ui(RP): add preview and force updater
This commit is contained in:
parent
a3b9edf4f3
commit
41bad09587
3 changed files with 43 additions and 2 deletions
|
|
@ -30,7 +30,6 @@ function UpdateButton() {
|
||||||
return <TouchableOpacity onPress={onPressCallback}>
|
return <TouchableOpacity onPress={onPressCallback}>
|
||||||
<FormText style={{ marginRight: 12 }}>UPDATE</FormText>
|
<FormText style={{ marginRight: 12 }}>UPDATE</FormText>
|
||||||
</TouchableOpacity>;
|
</TouchableOpacity>;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function Settings() {
|
export default function Settings() {
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,18 @@
|
||||||
|
|
||||||
|
import { findByProps, findByStoreName } from "@vendetta/metro";
|
||||||
import { React, stylesheet } from "@vendetta/metro/common";
|
import { React, stylesheet } from "@vendetta/metro/common";
|
||||||
import { storage } from "@vendetta/plugin";
|
import { storage } from "@vendetta/plugin";
|
||||||
import { useProxy } from "@vendetta/storage";
|
import { useProxy } from "@vendetta/storage";
|
||||||
import { semanticColors } from "@vendetta/ui";
|
import { semanticColors } from "@vendetta/ui";
|
||||||
import { Forms } from "@vendetta/ui/components";
|
import { Button, Forms } from "@vendetta/ui/components";
|
||||||
|
|
||||||
import { ScrollView } from "react-native";
|
import { ScrollView } from "react-native";
|
||||||
|
|
||||||
const { FormSection, FormInput, FormRow, FormSwitch, FormText } = Forms;
|
const { FormSection, FormInput, FormRow, FormSwitch, FormText } = Forms;
|
||||||
|
|
||||||
|
const UserStore = findByStoreName("UserStore");
|
||||||
|
const profiles = findByProps("showUserProfile");
|
||||||
|
|
||||||
const styles = stylesheet.createThemedStyleSheet({
|
const styles = stylesheet.createThemedStyleSheet({
|
||||||
subText: {
|
subText: {
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
|
|
@ -25,6 +30,16 @@ export default function ConfigEditor({ selection }: { selection: string }) {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ScrollView style={{ flex: 1 }} contentContainerStyle={{ paddingBottom: 38 }}>
|
<ScrollView style={{ flex: 1 }} contentContainerStyle={{ paddingBottom: 38 }}>
|
||||||
|
<Button
|
||||||
|
style={{ margin: 16 }}
|
||||||
|
color={"brand"}
|
||||||
|
size={Button.Sizes.MEDIUM}
|
||||||
|
look={Button.Looks.FILLED}
|
||||||
|
onPress={async () => {
|
||||||
|
profiles.showUserProfile({ userId: UserStore.getCurrentUser().id });
|
||||||
|
}}
|
||||||
|
text="Preview your profile"
|
||||||
|
/>
|
||||||
<FormSection title="Basic" titleStyleType="no_border">
|
<FormSection title="Basic" titleStyleType="no_border">
|
||||||
<FormInput required autoFocus
|
<FormInput required autoFocus
|
||||||
title="Application Name"
|
title="Application Name"
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,39 @@
|
||||||
|
import RPInstance from ".";
|
||||||
|
|
||||||
|
import { NavigationNative } from "@vendetta/metro/common";
|
||||||
import plugin from "@vendetta/plugin";
|
import plugin from "@vendetta/plugin";
|
||||||
|
import { Forms } from "@vendetta/ui/components";
|
||||||
import ConfigEditor from "./ConfigEditor";
|
import ConfigEditor from "./ConfigEditor";
|
||||||
|
|
||||||
|
import { useEffect } from "react";
|
||||||
|
import { TouchableOpacity } from "react-native";
|
||||||
|
|
||||||
|
const { FormText } = Forms;
|
||||||
const storage = plugin.storage as typeof plugin.storage & {
|
const storage = plugin.storage as typeof plugin.storage & {
|
||||||
selected: string;
|
selected: string;
|
||||||
selections: Record<string, Activity>;
|
selections: Record<string, Activity>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function UpdateButton() {
|
||||||
|
async function onPressCallback() {
|
||||||
|
RPInstance.onUnload();
|
||||||
|
RPInstance.onLoad();
|
||||||
|
}
|
||||||
|
|
||||||
|
return <TouchableOpacity onPress={onPressCallback}>
|
||||||
|
<FormText style={{ marginRight: 12 }}>UPDATE</FormText>
|
||||||
|
</TouchableOpacity>;
|
||||||
|
}
|
||||||
|
|
||||||
export default function Settings() {
|
export default function Settings() {
|
||||||
|
const navigation = NavigationNative.useNavigation();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
navigation.setOptions({
|
||||||
|
headerRight: UpdateButton
|
||||||
|
});
|
||||||
|
}, []);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ConfigEditor selection={storage.selected} />
|
<ConfigEditor selection={storage.selected} />
|
||||||
);
|
);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue