Skip to content

Commit

Permalink
feat: add sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
ivanberry committed May 18, 2023
1 parent f2a02dc commit 3e6829b
Show file tree
Hide file tree
Showing 6 changed files with 4,525 additions and 4,505 deletions.
5 changes: 5 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ ENV PROXY_URL=""
ENV OPENAI_API_KEY=""
ENV CODE=""

ENV NEXT_PUBLIC_SIDEBAR_TITLE='AI助手'
ENV NEXT_PUBLIC_DOCUMENT_TITLE='有AI随行'
ENV NEXT_PUBLIC_SHOP_URL='https://shop.ez-listen.app'
ENV NEXT_PUBLIC_SHOW_VERSION=''

COPY --from=builder /app/public ./public
COPY --from=builder /app/.next/standalone ./
COPY --from=builder /app/.next/static ./.next/static
Expand Down
25 changes: 0 additions & 25 deletions app/components/settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -350,31 +350,6 @@ export function Settings() {
</Popover>
</ListItem>

<ListItem
title={Locale.Settings.Update.Version(currentVersion ?? "unknown")}
subTitle={
checkingUpdate
? Locale.Settings.Update.IsChecking
: hasNewVersion
? Locale.Settings.Update.FoundUpdate(remoteId ?? "ERROR")
: Locale.Settings.Update.IsLatest
}
>
{checkingUpdate ? (
<LoadingIcon />
) : hasNewVersion ? (
<Link href={UPDATE_URL} target="_blank" className="link">
{Locale.Settings.Update.GoToUpdate}
</Link>
) : (
<IconButton
icon={<ResetIcon></ResetIcon>}
text={Locale.Settings.Update.CheckUpdate}
onClick={() => checkUpdate(true)}
/>
)}
</ListItem>

<ListItem title={Locale.Settings.SendKey}>
<Select
value={config.submitKey}
Expand Down
18 changes: 10 additions & 8 deletions app/components/sidebar.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { useEffect, useRef } from "react";
import { BsShop } from "react-icons/bs";

import styles from "./home.module.scss";

Expand Down Expand Up @@ -136,13 +137,6 @@ export function SideBar(props: { className?: string }) {
onClick={() => navigate(Path.NewChat, { state: { fromHome: true } })}
shadow
/>
<IconButton
icon={<PluginIcon />}
text={shouldNarrow ? undefined : Locale.Plugin.Name}
className={styles["sidebar-bar-button"]}
onClick={() => showToast(Locale.WIP)}
shadow
/>
</div>

<div
Expand Down Expand Up @@ -173,12 +167,20 @@ export function SideBar(props: { className?: string }) {
<IconButton icon={<SettingsIcon />} shadow />
</Link>
</div>
</div>
{process.env.NEXT_PUBLIC_SHOP_URL ? (
<div className={styles["sidebar-action"]}>
<a href={process.env.NEXT_PUBLIC_SHOP_URL} target="_blank">
<IconButton icon={<BsShop />} shadow />
</a>
</div>
) : (
<div className={styles["sidebar-action"]}>
<a href={REPO_URL} target="_blank">
<IconButton icon={<GithubIcon />} shadow />
</a>
</div>
</div>
)}
<div>
<IconButton
icon={<AddIcon />}
Expand Down
2 changes: 1 addition & 1 deletion app/store/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export enum Theme {
}

export const DEFAULT_CONFIG = {
submitKey: SubmitKey.CtrlEnter as SubmitKey,
submitKey: SubmitKey.Enter as SubmitKey,
avatar: "1f603",
fontSize: 14,
theme: Theme.Auto as Theme,
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"node-fetch": "^3.3.1",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-icons": "^4.8.0",
"react-markdown": "^8.0.5",
"react-router-dom": "^6.10.0",
"rehype-highlight": "^6.0.0",
Expand Down
Loading

0 comments on commit 3e6829b

Please sign in to comment.