diff --git a/src/components/character/CharacterDetailsPage.tsx b/src/components/character/CharacterDetailsPage.tsx new file mode 100644 index 00000000..fd153ff2 --- /dev/null +++ b/src/components/character/CharacterDetailsPage.tsx @@ -0,0 +1,45 @@ +import { useTranslation } from "react-i18next"; +import { BasicPage, Link } from "../settings/common"; +import { TextButton } from "../textButton"; +import { useCharacterStoreContext } from "@/features/characters/characterStoreContext"; +import { NameComponent } from "./NameComponent"; +import { TagComponent } from "./TagComponent"; +import { SystemPromptComponent } from "./SystemPromptComponent"; + +export function CharacterDetailsPage({ + setSettingsUpdated + }: { + setSettingsUpdated: (updated: boolean) => void; + }) { + const { t } = useTranslation(); + const characterContext = useCharacterStoreContext(); + + return ( + + {/*
*/} + + {/*
*/} + { characterContext.saveCharacter(); }} + > + {t("Save Character")} + +
+ + ); +} + diff --git a/src/components/character/CharacterListPage.tsx b/src/components/character/CharacterListPage.tsx new file mode 100644 index 00000000..82eced51 --- /dev/null +++ b/src/components/character/CharacterListPage.tsx @@ -0,0 +1,25 @@ +import { useCharacterStoreContext } from "@/features/characters/characterStoreContext"; +import { VrmListPage } from "../settings/VrmListPage"; +import Character from "@/features/characters/character"; + +export const CharacterListPage = ({ + viewer, + setSettingsUpdated, + handleClickOpenVrmFile, + }: { + viewer: any; // TODO + setSettingsUpdated: (updated: boolean) => void; + handleClickOpenVrmFile: () => void; + }) => { + const characterStoreContext = useCharacterStoreContext(); + + return +} \ No newline at end of file diff --git a/src/components/character/CharacterListProvider.ts b/src/components/character/CharacterListProvider.ts new file mode 100644 index 00000000..e69de29b diff --git a/src/components/character/CharactersPage.tsx b/src/components/character/CharactersPage.tsx new file mode 100644 index 00000000..3dcb482b --- /dev/null +++ b/src/components/character/CharactersPage.tsx @@ -0,0 +1,114 @@ +import { useState } from "react"; +import { Link } from "../settings/common"; +import { ArrowUturnLeftIcon, ChevronRightIcon, HomeIcon } from "@heroicons/react/20/solid"; +import { TextButton } from "../textButton"; +import { CharacterDetailsPage } from "./CharacterDetailsPage"; + +export const CharactersPage = ({ + setSettingsUpdated, + handleClickOpenVrmFile, + onClickClose +}: { + setSettingsUpdated: (updated: boolean) => void; + handleClickOpenVrmFile: () => void; + onClickClose: () => void; +}) => { + const [breadcrumbs, setBreadcrumbs] = useState([]); + const [page, setPage] = useState('current_character'); + + function renderPage() { + switch(page) { + case 'current_character': + return ; + + default: + throw new Error('page not found'); + } + } + + return ( +
+
+
+ + +
+ +
+
+
+ { + if (breadcrumbs.length === 0) { + onClickClose(); + return; + } + if (breadcrumbs.length === 1) { + setPage('main_menu'); + setBreadcrumbs([]); + return; + } + + const prevPage = breadcrumbs[breadcrumbs.length - 2]; + setPage(prevPage.key); + setBreadcrumbs(breadcrumbs.slice(0, -1)); + }} + > + + + { renderPage() } +
+
+
+
+ ); +} \ No newline at end of file diff --git a/src/components/character/NameComponent.tsx b/src/components/character/NameComponent.tsx new file mode 100644 index 00000000..71d9055f --- /dev/null +++ b/src/components/character/NameComponent.tsx @@ -0,0 +1,36 @@ +import { t } from "@/i18n"; +import { FormRow, ResetToDefaultButton } from "../settings/common"; +import { TextInput } from "../textInput"; +import { defaultConfig, updateConfig } from "@/utils/config"; + +interface NameComponentProps { + name: string + setName: (name: string) => void + setSettingsUpdated: (updated: boolean) => void +}; + +export const NameComponent: React.FC = ({name, setName, setSettingsUpdated}) => { + return <> + + ) => { + setName(event.target.value); + updateConfig("name", event.target.value); + setSettingsUpdated(true); + }} + /> + + { name !== defaultConfig("name") && ( +

+ { + setName(defaultConfig("name")); + updateConfig("name", defaultConfig("name")); + setSettingsUpdated(true); + }} + /> +

+ )} +
+ ; +} \ No newline at end of file diff --git a/src/components/character/SystemPromptComponent.tsx b/src/components/character/SystemPromptComponent.tsx new file mode 100644 index 00000000..19c8ff05 --- /dev/null +++ b/src/components/character/SystemPromptComponent.tsx @@ -0,0 +1,41 @@ +import { useTranslation } from 'react-i18next'; + +import { updateConfig, defaultConfig } from "@/utils/config"; +import { FormRow, ResetToDefaultButton } from '../settings/common'; + +export function SystemPromptComponent({ + systemPrompt, + setSystemPrompt, + setSettingsUpdated, +}: { + systemPrompt: string; + setSystemPrompt: (prompt: string) => void; + setSettingsUpdated: (updated: boolean) => void; +}) { + const { t } = useTranslation(); + + return ( + +