diff --git a/apps/amethyst/app/(tabs)/settings/index.tsx b/apps/amethyst/app/(tabs)/settings/index.tsx new file mode 100644 index 0000000..9435b05 --- /dev/null +++ b/apps/amethyst/app/(tabs)/settings/index.tsx @@ -0,0 +1,163 @@ +import React, { useState } from "react"; +import { Text } from "@/components/ui/text"; +import { ScrollView, Switch, View } from "react-native"; +import { Link, Stack } from "expo-router"; +import { useColorScheme } from "@/lib/useColorScheme"; +import { cn } from "@/lib/utils"; +import { Button } from "@/components/ui/button"; + +import pkg from "@/package.json"; +import { useStore } from "@/stores/mainStore"; +import { Input } from "@/components/ui/input"; + +export default function Settings() { + const { colorScheme, setColorScheme } = useColorScheme(); + const appviewDid = useStore((state) => state.tealDid); + const setAppviewDid = useStore((state) => state.setTealDid); + + const colorSchemeOptions = [ + { label: "Light", value: "light" }, + { label: "Dark", value: "dark" }, + { label: "System", value: "system" }, + ]; + + return ( + + + + + setAppviewDid(e)} + placeholder="Enter your Appview DID (e.g., did:plc:...)" + /> + + + + + + teal.fm amethyst ver. {pkg.version} + + + react native{" "} + {pkg.dependencies["react-native"] + .replace("~", "") + .split(".") + .slice(0, 2) + .join(".")} + , expo {pkg.dependencies.expo.split(".")[0].replace("~", "")}. + + + + + ); +} + +function ToggleSwitch({ + text, + isEnabled, + setIsEnabled, +}: { + text: string; + isEnabled: boolean; + setIsEnabled: React.Dispatch>; +}) { + const toggleSwitch = () => + setIsEnabled((previousState: boolean) => !previousState); + + return ( + + {text} + + + ); +} + +/// A selector component for smaller selections (usu. <3 values) +function ButtonSelector({ + text, + values, + selectedValue, + setSelectedValue, +}: { + text: string; + values: { label: string; value: string }[]; + selectedValue: string; + setSelectedValue: (value: any) => void; +}) { + return ( + + {text} + + {values.map(({ label, value }) => ( + + ))} + + + ); +} + +function TextInputRow({ + labelText, + initialValue = "", // Added initialValue prop, defaults to empty string + onSubmit, + placeholder, +}: { + labelText: string; + initialValue?: string; // Made initialValue optional + onSubmit: (value: string) => void; // onSubmit now takes the string value + placeholder?: string; +}) { + const [inputValue, setInputValue] = useState(initialValue); // Internal state for the input + + const handleSubmit = () => { + onSubmit(inputValue); + }; + + return ( + + {labelText} + + + + + + ); +}