Skip to content

Commit

Permalink
refactor: refactor icons
Browse files Browse the repository at this point in the history
  • Loading branch information
Peek-A-Booo committed Jun 30, 2023
1 parent 02280d5 commit 3024150
Show file tree
Hide file tree
Showing 117 changed files with 2,483 additions and 452 deletions.
6 changes: 1 addition & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@
},
"dependencies": {
"@emotion/css": "11.11.2",
"@iconify/icons-devicon": "1.2.11",
"@iconify/icons-mingcute": "1.2.6",
"@iconify/icons-simple-icons": "1.2.57",
"@iconify/react": "4.1.1",
"@next-auth/prisma-adapter": "1.0.7",
"@prisma/client": "4.16.1",
"@radix-ui/react-accordion": "1.1.2",
Expand Down Expand Up @@ -55,7 +51,7 @@
"microsoft-cognitiveservices-speech-sdk": "1.29.0",
"next": "13.4.7",
"next-auth": "4.22.1",
"next-intl": "2.16.0",
"next-intl": "2.17.0",
"next-themes": "0.2.1",
"nodemailer": "6.9.3",
"postcss": "8.4.24",
Expand Down
57 changes: 7 additions & 50 deletions pnpm-lock.yaml

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

5 changes: 2 additions & 3 deletions src/components/announcement/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import React from "react";
import * as Toast from "@radix-ui/react-toast";
import { useTranslations, useLocale } from "next-intl";
import { cn } from "@/lib";
import { Icon } from "@/components/ui";
import check_line from "@iconify/icons-mingcute/check-line";
import Icon from "@/components/icon";
import pkg from "../../../package.json";

export default function Announcement() {
Expand Down Expand Up @@ -73,7 +72,7 @@ export default function Announcement() {
"bg-sky-400 hover:bg-sky-500 active:bg-sky-600 text-white dark:bg-sky-400/90 dark:hover:bg-sky-500/90 dark:active:bg-sky-600/90"
)}
>
<Icon icon={check_line} />
<Icon icon="check_line" />
</button>
</Toast.Action>
</Toast.Root>
Expand Down
7 changes: 3 additions & 4 deletions src/components/apiKeySetting/azure.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from "react";
import { useTranslations } from "next-intl";
import toast from "react-hot-toast";
import question_line from "@iconify/icons-mingcute/question-line";
import { cn } from "@/lib";
import { useOpenAI, useLLM } from "@/hooks";
import Icon from "@/components/icon";
import {
Button,
Divider,
Expand All @@ -12,7 +12,6 @@ import {
Select,
Slider,
Tooltip,
Icon,
} from "@/components/ui";

const Azure: React.FC = () => {
Expand Down Expand Up @@ -155,7 +154,7 @@ const Azure: React.FC = () => {
<div className="mb-1 text-sm flex items-center gap-2">
{t("temperature")}
<Tooltip title={t("temperature-tip")}>
<Icon icon={question_line} size={18} />
<Icon icon="question_line" size={18} />
</Tooltip>
</div>
<div className="flex items-center gap-2">
Expand All @@ -180,7 +179,7 @@ const Azure: React.FC = () => {
<div className="mb-1 text-sm flex items-center gap-2">
{t("max-tokens")}
<Tooltip title={t("max-tokens-tip")}>
<Icon icon={question_line} size={18} />
<Icon icon="question_line" size={18} />
</Tooltip>
</div>
<Input
Expand Down
11 changes: 5 additions & 6 deletions src/components/apiKeySetting/openai.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ import { useTranslations } from "next-intl";
import { toast } from "react-hot-toast";
import { cn } from "@/lib";
import { useOpenAI } from "@/hooks";
import { Button, Input, Slider, Tooltip, Icon } from "@/components/ui";
import check_line from "@iconify/icons-mingcute/check-line";
import question_line from "@iconify/icons-mingcute/question-line";
import Icon from "@/components/icon";
import { Button, Input, Slider, Tooltip } from "@/components/ui";

type CheckStatus = "" | "success" | "error";

Expand Down Expand Up @@ -87,7 +86,7 @@ export default function OpenAI() {
<Button
className="w-22 md:w-28"
type="primary"
leftIcon={<Icon icon={check_line} />}
leftIcon={<Icon icon="check_line" />}
loading={loading}
onClick={onCheck}
>
Expand Down Expand Up @@ -125,7 +124,7 @@ export default function OpenAI() {
<div className="mb-1 text-sm flex items-center gap-2">
{t("temperature")}
<Tooltip title={t("temperature-tip")}>
<Icon icon={question_line} size={18} />
<Icon icon="question_line" size={18} />
</Tooltip>
</div>
<div className="flex items-center gap-2">
Expand All @@ -150,7 +149,7 @@ export default function OpenAI() {
<div className="mb-1 text-sm flex items-center gap-2">
{t("max-tokens")}
<Tooltip title={t("max-tokens-tip")}>
<Icon icon={question_line} size={18} />
<Icon icon="question_line" size={18} />
</Tooltip>
</div>
<Input
Expand Down
9 changes: 4 additions & 5 deletions src/components/chatConfigure/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,8 @@ import {
type ChannelIcon,
type IPrompt,
} from "@/hooks";
import { Button, Divider, Modal, Select, Icon } from "@/components/ui";
import refresh_3_line from "@iconify/icons-mingcute/refresh-3-line";
import translate_line from "@iconify/icons-mingcute/translate-line";
import Icon from "@/components/icon";
import { Button, Divider, Modal, Select } from "@/components/ui";
import MenuIcon from "@/components/menu/icon";
import PremiumBtn from "./premiumBtn";

Expand Down Expand Up @@ -239,7 +238,7 @@ const Configure = React.memo(() => {
</div>
</div>
<Icon
icon={refresh_3_line}
icon="refresh_3_line"
size={20}
className="top-3 right-3 text-sky-400 absolute"
onClick={onResetPrompt}
Expand Down Expand Up @@ -333,7 +332,7 @@ const Configure = React.memo(() => {
className="top-[-0.5rem] right-0 absolute"
onClick={onToggleLan}
>
<Icon icon={translate_line} size={18} />
<Icon icon="translate_line" size={18} />
</Button>
)}
</div>
Expand Down
6 changes: 3 additions & 3 deletions src/components/chatConfigure/premiumBtn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import React from "react";
import { useSession } from "next-auth/react";
import { useTranslations } from "next-intl";
import { usePremium, useUserInfo } from "@/hooks";
import { Button, Icon } from "@/components/ui";
import gift_fill from "@iconify/icons-mingcute/gift-fill";
import Icon from "@/components/icon";
import { Button } from "@/components/ui";

const PremiumBtn: React.FC = () => {
const session = useSession();
Expand All @@ -30,7 +30,7 @@ const PremiumBtn: React.FC = () => {
size="base"
onClick={onCheck}
>
<Icon icon={gift_fill} size={26} className="text-orange-400" />
<Icon icon="gift_fill" size={26} className="text-orange-400" />
<span>{tCommon("premium")}</span>
</Button>
);
Expand Down
8 changes: 3 additions & 5 deletions src/components/chatContent/codeblock.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ import { useTranslations } from "next-intl";
import { useClipboard } from "l-hooks";
import { Prism as SyntaxHighlighter } from "react-syntax-highlighter";
import { oneDark } from "react-syntax-highlighter/dist/cjs/styles/prism";
import { Icon } from "@/components/ui";
import check_line from "@iconify/icons-mingcute/check-line";
import copy_2_line from "@iconify/icons-mingcute/copy-2-line";
import Icon from "@/components/icon";

interface Props {
language: string;
Expand Down Expand Up @@ -35,15 +33,15 @@ const CodeBlock: React.FC<Props> = React.memo(({ language, value }) => {
{isCopied ? (
<>
<Icon
icon={check_line}
icon="check_line"
className="text-[#52c41a] mr-1"
size={18}
/>
{t("copied")}!
</>
) : (
<>
<Icon icon={copy_2_line} className="mr-1" size={18} />{" "}
<Icon icon="copy_2_line" className="mr-1" size={18} />
{t("copy-code")}
</>
)}
Expand Down
18 changes: 7 additions & 11 deletions src/components/chatSection/chatFooter/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,8 @@ import toast from "react-hot-toast";
import type { ChatItem } from "@/hooks/useChannel";
import { useChannel, useLLM, useScrollToBottom, BASE_PROMPT } from "@/hooks";
import { useChatGPT } from "@/hooks/useChatGPT";
import { Button, Confirm, Icon } from "@/components/ui";
import stop_fill from "@iconify/icons-mingcute/stop-fill";
import share_2_line from "@iconify/icons-mingcute/share-2-line";
import document_line from "@iconify/icons-mingcute/document-line";
import loading_line from "@iconify/icons-mingcute/loading-line";
import broom_line from "@iconify/icons-mingcute/broom-line";
import Icon from "@/components/icon";
import { Button, Confirm } from "@/components/ui";
import { isMobile, cn } from "@/lib";
import type { IShare } from "@/app/api/share/route";
import Action from "@/components/share/action";
Expand Down Expand Up @@ -185,7 +181,7 @@ const ChatFooter: React.FC = () => {
className="rounded-full"
type="danger"
onClick={cancel}
leftIcon={<Icon icon={stop_fill} size={18} />}
leftIcon={<Icon icon="stop_fill" size={18} />}
>
{t("stop-generate")}
</Button>
Expand All @@ -194,7 +190,7 @@ const ChatFooter: React.FC = () => {
<Button
className="rounded-full"
type="outline"
leftIcon={<Icon icon={share_2_line} size={18} />}
leftIcon={<Icon icon="share_2_line" size={18} />}
loading={loadingShare}
onClick={handleShare}
>
Expand All @@ -207,7 +203,7 @@ const ChatFooter: React.FC = () => {
className="rounded-full"
type="success"
onClick={() => window.open("https://docs.ltopx.com", "_blank")}
leftIcon={<Icon icon={document_line} size={18} />}
leftIcon={<Icon icon="document_line" size={18} />}
>
{tCommon("docs")}
</Button>
Expand All @@ -230,11 +226,11 @@ const ChatFooter: React.FC = () => {
{loadingChannel ? (
<Icon
className="animate-spin"
icon={loading_line}
icon="loading_line"
size={24}
/>
) : (
<Icon icon={broom_line} size={24} />
<Icon icon="broom_line" size={24} />
)}
</div>
}
Expand Down
8 changes: 3 additions & 5 deletions src/components/chatSection/chatFooter/inputArea.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ import React from "react";
import { useTranslations } from "next-intl";
import { useConfig } from "@/hooks";
import { isMobile, getPlatform, cn } from "@/lib";
import { Icon } from "@/components/ui";
import loading_line from "@iconify/icons-mingcute/loading-line";
import send_line from "@iconify/icons-mingcute/send-line";
import Icon from "@/components/icon";

export interface ChatInputProps {
className?: string | undefined;
Expand Down Expand Up @@ -129,7 +127,7 @@ const ChatInput = React.forwardRef<ChatInputRef, ChatInputProps>(
"dark:text-sky-400/90"
)}
>
<Icon className="animate-spin" icon={loading_line} size={24} />
<Icon className="animate-spin" icon="loading_line" size={24} />
</div>
) : (
<div
Expand All @@ -141,7 +139,7 @@ const ChatInput = React.forwardRef<ChatInputRef, ChatInputProps>(
{ "text-sky-400 dark:text-sky-400/90": value }
)}
>
<Icon icon={send_line} size={24} />
<Icon icon="send_line" size={24} />
</div>
)}
</div>
Expand Down
Loading

1 comment on commit 3024150

@vercel
Copy link

@vercel vercel bot commented on 3024150 Jun 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.