Skip to content

Commit

Permalink
add clean feature and fix browser compatibility in safari 17
Browse files Browse the repository at this point in the history
  • Loading branch information
zmh-program committed Oct 26, 2023
1 parent 6a4d3f0 commit 8f7866f
Show file tree
Hide file tree
Showing 16 changed files with 170 additions and 140 deletions.
51 changes: 25 additions & 26 deletions app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,34 +11,33 @@
"preview": "vite preview"
},
"dependencies": {
"@radix-ui/react-alert-dialog": "^1.0.5",
"@radix-ui/react-context-menu": "^2.1.5",
"@radix-ui/react-dialog": "^1.0.5",
"@radix-ui/react-dropdown-menu": "^2.0.6",
"@radix-ui/react-alert-dialog": "^1.0.4",
"@radix-ui/react-context-menu": "^2.1.4",
"@radix-ui/react-dialog": "^1.0.4",
"@radix-ui/react-dropdown-menu": "^2.0.5",
"@radix-ui/react-label": "^2.0.2",
"@radix-ui/react-scroll-area": "^1.0.5",
"@radix-ui/react-select": "^2.0.0",
"@radix-ui/react-separator": "^1.0.3",
"@radix-ui/react-slot": "^1.0.2",
"@radix-ui/react-switch": "^1.0.3",
"@radix-ui/react-toast": "^1.1.5",
"@radix-ui/react-toast": "^1.1.4",
"@radix-ui/react-toggle": "^1.0.3",
"@radix-ui/react-tooltip": "^1.0.7",
"@reduxjs/toolkit": "^1.9.7",
"axios": "^1.5.1",
"@radix-ui/react-tooltip": "^1.0.6",
"@reduxjs/toolkit": "^1.9.5",
"axios": "^1.5.0",
"chart.js": "^4.4.0",
"class-variance-authority": "^0.7.0",
"clsx": "^2.0.0",
"i18next": "^23.6.0",
"i18next": "^23.4.6",
"localforage": "^1.10.0",
"lucide-react": "^0.289.0",
"match-sorter": "^6.3.1",
"react": "^18.2.0",
"react-chartjs-2": "^5.2.0",
"react-dom": "^18.2.0",
"react-i18next": "^13.3.1",
"react-i18next": "^13.2.2",
"react-markdown": "^8.0.7",
"react-redux": "^8.1.3",
"react-redux": "^8.1.2",
"react-router-dom": "^6.17.0",
"react-syntax-highlighter": "^15.5.0",
"rehype-katex": "^6.0.3",
Expand All @@ -50,25 +49,25 @@
"workbox-window": "^7.0.0"
},
"devDependencies": {
"@types/node": "^20.8.9",
"@types/react": "^18.2.33",
"@types/react-dom": "^18.2.14",
"@types/react-syntax-highlighter": "^15.5.9",
"@typescript-eslint/eslint-plugin": "^6.9.0",
"@typescript-eslint/parser": "^6.9.0",
"@vitejs/plugin-react-swc": "^3.4.0",
"autoprefixer": "^10.4.16",
"eslint": "^8.52.0",
"@types/node": "^20.5.9",
"@types/react": "^18.2.15",
"@types/react-dom": "^18.2.7",
"@types/react-syntax-highlighter": "^15.5.7",
"@typescript-eslint/eslint-plugin": "^6.0.0",
"@typescript-eslint/parser": "^6.0.0",
"@vitejs/plugin-react-swc": "^3.3.2",
"autoprefixer": "^10.4.15",
"eslint": "^8.45.0",
"eslint-plugin-react-hooks": "^4.6.0",
"eslint-plugin-react-refresh": "^0.4.3",
"less": "^4.2.0",
"less-loader": "^11.1.3",
"postcss": "^8.4.31",
"postcss": "^8.4.29",
"prettier": "^3.0.3",
"tailwindcss": "^3.3.5",
"typescript": "^5.2.2",
"vite": "^4.5.0",
"tailwindcss": "^3.3.3",
"typescript": "^5.0.2",
"vite": "^4.4.5",
"vite-plugin-html": "^3.2.0",
"vite-plugin-pwa": "^0.16.5"
"vite-plugin-pwa": "^0.16.4"
}
}
82 changes: 25 additions & 57 deletions app/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 10 additions & 5 deletions app/src/components/Markdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { useEffect } from "react";
import { useDispatch } from "react-redux";
import { openDialog as openQuotaDialog } from "../store/quota.ts";
import { openDialog as openSubscriptionDialog } from "../store/subscription.ts";
import {AppDispatch} from "../store";
import { AppDispatch } from "../store";

type MarkdownProps = {
children: string;
Expand Down Expand Up @@ -50,12 +50,17 @@ function Markdown({ children, className }: MarkdownProps) {
const url: string = href?.toString() || "";

return (
<a href={url} target={`_blank`} rel={`noopener noreferrer`} onClick={(e) => {
if (doAction(dispatch, url)) e.preventDefault();
}}>
<a
href={url}
target={`_blank`}
rel={`noopener noreferrer`}
onClick={(e) => {
if (doAction(dispatch, url)) e.preventDefault();
}}
>
{children}
</a>
)
);
},
code({ inline, className, children, ...props }) {
const match = /language-(\w+)/.exec(className || "");
Expand Down
17 changes: 16 additions & 1 deletion app/src/components/ProjectLink.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
import { Button } from "./ui/button.tsx";
import { selectMessages } from "../store/chat.ts";
import { useDispatch, useSelector } from "react-redux";
import { MessageSquarePlus } from "lucide-react";
import { toggleConversation } from "../conversation/history.ts";

function ProjectLink() {
return (
const dispatch = useDispatch();
const messages = useSelector(selectMessages);

return messages.length > 0 ? (
<Button
variant="outline"
size="icon"
onClick={async () => await toggleConversation(dispatch, -1)}
>
<MessageSquarePlus className={`h-4 w-4`} />
</Button>
) : (
<Button
variant="outline"
size="icon"
Expand Down
10 changes: 8 additions & 2 deletions app/src/components/SelectGroup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,9 @@ function SelectGroupDesktop(props: SelectGroupProps) {
</span>
</SelectValue>
</SelectTrigger>
<SelectContent className={`${props.className} ${props.classNameDesktop}`}>
<SelectContent
className={`${props.className} ${props.classNameDesktop}`}
>
{hidden.map((select: SelectItemProps, idx: number) => (
<SelectItem key={idx} value={select.name}>
<GroupSelectItem {...select} />
Expand All @@ -109,7 +111,11 @@ function SelectGroupMobile(props: SelectGroupProps) {
<SelectTrigger className="select-group mobile">
<SelectValue placeholder={props.current.value} />
</SelectTrigger>
<SelectContent position={`item-aligned`} side={props.side} className={`${props.className} ${props.classNameMobile}`}>
<SelectContent
position={`item-aligned`}
side={props.side}
className={`${props.className} ${props.classNameMobile}`}
>
{props.list.map((select: SelectItemProps, idx: number) => (
<SelectItem key={idx} value={select.name}>
<GroupSelectItem {...select} />
Expand Down
Loading

0 comments on commit 8f7866f

Please sign in to comment.