Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

enhancement-implemented #56

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/components/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import { ViewerContext } from "@/features/vrmViewer/viewerContext";
import { config, updateConfig } from "@/utils/config";


import { Link } from "./settings/common";
import { CustomLink } from "./settings/common";

import { MenuPage } from './settings/MenuPage';
import { ResetSettingsPage } from './settings/ResetSettingsPage';
Expand Down Expand Up @@ -68,7 +68,7 @@ export const Settings = ({
useKeyboardShortcut("Escape", onClickClose);

const [page, setPage] = useState('main_menu');
const [breadcrumbs, setBreadcrumbs] = useState<Link[]>([]);
const [breadcrumbs, setBreadcrumbs] = useState<CustomLink[]>([]);
const [showNotification, setShowNotification] = useState(false);
const [settingsUpdated, setSettingsUpdated] = useState(false);

Expand Down Expand Up @@ -218,7 +218,7 @@ export const Settings = ({
]);


function handleMenuClick(link: Link) {
function handleMenuClick(link: CustomLink) {
setPage(link.key)
setBreadcrumbs([...breadcrumbs, link]);
}
Expand Down
6 changes: 3 additions & 3 deletions src/components/settings/ChatbotBackendPage.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useTranslation } from 'react-i18next';
import { useEffect, useState } from 'react';
import { getWindowAI } from "window.ai";
import { BasicPage, Link, FormRow, getLinkFromPage } from './common';
import { BasicPage, CustomLink, FormRow, getLinkFromPage } from './common';
import { updateConfig } from "@/utils/config";

const chatbotBackends = [
Expand Down Expand Up @@ -29,8 +29,8 @@ export function ChatbotBackendPage({
setChatbotBackend: (backend: string) => void;
setSettingsUpdated: (updated: boolean) => void;
setPage: (page: string) => void;
breadcrumbs: Link[];
setBreadcrumbs: (breadcrumbs: Link[]) => void;
breadcrumbs: CustomLink[];
setBreadcrumbs: (breadcrumbs: CustomLink[]) => void;
}) {
const { t } = useTranslation();
const [windowAiDetected, setWindowAiDetected] = useState(false);
Expand Down
4 changes: 2 additions & 2 deletions src/components/settings/MenuPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ import { useTranslation } from 'react-i18next';
import { clsx } from 'clsx';

import { ChevronRightIcon } from '@heroicons/react/20/solid';
import { Link, pagesToLinks } from './common';
import { CustomLink, pagesToLinks } from './common';

export function MenuPage({
keys,
menuClick,
}: {
keys: string[];
menuClick: (link: Link) => void;
menuClick: (link: CustomLink) => void;
}) {
const { t } = useTranslation();

Expand Down
6 changes: 3 additions & 3 deletions src/components/settings/STTBackendPage.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useTranslation } from 'react-i18next';

import { BasicPage, FormRow, getLinkFromPage, Link } from './common';
import { BasicPage, FormRow, getLinkFromPage, CustomLink } from './common';
import { updateConfig } from "@/utils/config";

const sttEngines = [
Expand All @@ -26,8 +26,8 @@ export function STTBackendPage({
setSTTBackend: (backend: string) => void;
setSettingsUpdated: (updated: boolean) => void;
setPage: (page: string) => void;
breadcrumbs: Link[];
setBreadcrumbs: (breadcrumbs: Link[]) => void;
breadcrumbs: CustomLink[];
setBreadcrumbs: (breadcrumbs: CustomLink[]) => void;
}) {
const { t } = useTranslation();

Expand Down
6 changes: 3 additions & 3 deletions src/components/settings/TTSBackendPage.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useTranslation } from 'react-i18next';

import { BasicPage, FormRow, Link, getLinkFromPage } from './common';
import { BasicPage, FormRow, CustomLink, getLinkFromPage } from './common';
import { updateConfig } from "@/utils/config";

const ttsEngines = [
Expand All @@ -27,8 +27,8 @@ export function TTSBackendPage({
setTTSBackend: (backend: string) => void;
setSettingsUpdated: (updated: boolean) => void;
setPage: (page: string) => void;
breadcrumbs: Link[];
setBreadcrumbs: (breadcrumbs: Link[]) => void;
breadcrumbs: CustomLink[];
setBreadcrumbs: (breadcrumbs: CustomLink[]) => void;
}) {
const { t } = useTranslation();

Expand Down
6 changes: 3 additions & 3 deletions src/components/settings/VisionBackendPage.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useTranslation } from 'react-i18next';

import { BasicPage, FormRow, Link, getLinkFromPage } from './common';
import { BasicPage, FormRow, CustomLink, getLinkFromPage } from './common';
import { updateConfig } from "@/utils/config";

const visionEngines = [
Expand All @@ -25,8 +25,8 @@ export function VisionBackendPage({
setVisionBackend: (backend: string) => void;
setSettingsUpdated: (updated: boolean) => void;
setPage: (page: string) => void;
breadcrumbs: Link[];
setBreadcrumbs: (breadcrumbs: Link[]) => void;
breadcrumbs: CustomLink[];
setBreadcrumbs: (breadcrumbs: CustomLink[]) => void;
}) {
const { t } = useTranslation();

Expand Down
10 changes: 5 additions & 5 deletions src/components/settings/common.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ export function thumbPrefix(path: string) {
return a.join("/");
}

export type Link = {
export type CustomLink = {
key: string;
label: string;
icon?: JSX.Element;
Expand All @@ -106,8 +106,8 @@ export function getLinkFromPage(page: string) {
};
}

export function pagesToLinks(keys: string[]): Link[] {
const links: Link[] = [];
export function pagesToLinks(keys: string[]): CustomLink[] {
const links: CustomLink[] = [];
for (const key of keys) {
links.push(getLinkFromPage(key));
}
Expand All @@ -116,8 +116,8 @@ export function pagesToLinks(keys: string[]): Link[] {

export type PageProps = {
setPage: (page: string) => void;
breadcrumbs: Link[];
setBreadcrumbs: (breadcrumbs: Link[]) => void;
breadcrumbs: CustomLink[];
setBreadcrumbs: (breadcrumbs: CustomLink[]) => void;
}

export function getIconFromPage(page: string): JSX.Element {
Expand Down
Loading