Skip to content

Commit

Permalink
feat: Optimize UI details for prompt and Prompt Market
Browse files Browse the repository at this point in the history
  • Loading branch information
Peek-A-Booo committed Jun 10, 2023
1 parent a5a02c9 commit 91875fd
Show file tree
Hide file tree
Showing 15 changed files with 56 additions and 121 deletions.
1 change: 1 addition & 0 deletions CHANGE_LOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

- Optimized the display effect when the username is missing.
- Numerous other minor optimizations.
- Optimize UI details for prompt and Prompt Market

## v0.5.3

Expand Down
1 change: 1 addition & 0 deletions CHANGE_LOG.zh_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

- 优化用户名缺失时的显示效果
- 其他大量细节优化
- 优化 prompt 和 Prompt Market 的 UI 细节

## v0.5.3

Expand Down
10 changes: 4 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,13 @@
"@radix-ui/react-popover": "1.0.6",
"@radix-ui/react-select": "1.2.2",
"@radix-ui/react-slider": "1.1.2",
"@radix-ui/react-tabs": "^1.0.4",
"@radix-ui/react-tabs": "1.0.4",
"@radix-ui/react-toast": "1.1.4",
"@react-email/button": "^0.0.8",
"@react-email/components": "^0.0.6",
"@react-email/html": "^0.0.4",
"@react-email/render": "^0.0.7",
"@react-email/components": "0.0.6",
"@react-email/render": "0.0.7",
"@sentry/nextjs": "7.54.0",
"@svgr/webpack": "8.0.1",
"@types/node": "20.2.5",
"@types/node": "20.2.6",
"@types/react": "18.2.9",
"@types/react-dom": "18.2.4",
"@upstash/redis": "1.21.0",
Expand Down
22 changes: 8 additions & 14 deletions pnpm-lock.yaml

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

25 changes: 23 additions & 2 deletions src/components/chatSection/chatList/configure.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ const Configure = React.memo(() => {

return (
<>
<div className="flex flex-col h-full w-full pt-16 pb-24 top-0 left-0 gap-8 absolute">
<div className="flex flex-col h-full w-full pt-16 pb-24 top-0 left-0 gap-6 absolute">
{isShow && (
<motion.div
className="flex flex-col items-center justify-center"
Expand Down Expand Up @@ -190,7 +190,7 @@ const Configure = React.memo(() => {
)}
Prompt
</div>
<div className="text-neutral-800 dark:text-neutral-100 text-sm line-clamp-3">
<div className="text-neutral-800 dark:text-neutral-100 text-sm line-clamp-6 hover:line-clamp-none">
{findChannel?.channel_prompt}
</div>
</div>
Expand All @@ -202,6 +202,27 @@ const Configure = React.memo(() => {
</motion.div>
)}

{isShow && recentPrompt.length && (
<motion.div
className="flex justify-center"
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
transition={{ duration: 0.5 }}
>
<div className="bg-neutral-300 w-48 h-[1px] relative">
<span
className={cn(
"absolute text-sm px-3 left-[50%] translate-x-[-50%] translate-y-[-50%] select-none whitespace-nowrap",
"bg-[#f8f8fa] dark:bg-[#181818]",
"text-gray-500 dark:text-gray-300"
)}
>
{t("recently-used")}
</span>
</div>
</motion.div>
)}

{isShow && (
<motion.div
className="px-6 flex justify-center"
Expand Down
16 changes: 1 addition & 15 deletions src/components/menu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
AiOutlineSetting,
} from "react-icons/ai";
import { MdOutlineLightMode, MdDarkMode } from "react-icons/md";
import { HiLightBulb, HiOutlineTranslate } from "react-icons/hi";
import { HiOutlineTranslate } from "react-icons/hi";
import { RiFeedbackLine } from "react-icons/ri";
import { useDateFormat } from "l-hooks";
import { v4 as uuidv4 } from "uuid";
Expand Down Expand Up @@ -151,8 +151,6 @@ const Menu: React.FC = () => {

const onToggleTheme = () => setTheme(nowTheme === "light" ? "dark" : "light");

const onOpenPrompt = () => alert("Prompt Manage ToDo...");

const onLocaleChange = (value: string) => {
if (value === locale) return;
router.replace(value);
Expand Down Expand Up @@ -314,18 +312,6 @@ const Menu: React.FC = () => {
<AiFillGithub size={20} />
</a>
</div>
<div className="flex flex-1 justify-center">
<div
onClick={onOpenPrompt}
className={cn(
"w-8 h-8 flex justify-center items-center cursor-pointer transition-colors rounded-md",
"hover:bg-gray-200/60",
"dark:hover:bg-slate-700/70"
)}
>
<HiLightBulb size={20} />
</div>
</div>
<Dropdown
selectable
options={lans}
Expand Down
16 changes: 1 addition & 15 deletions src/components/menu/mobile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
AiOutlineSetting,
} from "react-icons/ai";
import { MdOutlineLightMode, MdDarkMode } from "react-icons/md";
import { HiLightBulb, HiOutlineTranslate } from "react-icons/hi";
import { HiOutlineTranslate } from "react-icons/hi";
import { RiFeedbackLine } from "react-icons/ri";
import { v4 as uuidv4 } from "uuid";
import { cn } from "@/lib";
Expand Down Expand Up @@ -114,8 +114,6 @@ const MobileMenu: React.FC = () => {

const onToggleTheme = () => setTheme(nowTheme === "light" ? "dark" : "light");

const onOpenPrompt = () => alert("Prompt Manage ToDo...");

const onLocaleChange = (value: string) => {
if (value === locale) return;
onClose();
Expand Down Expand Up @@ -284,18 +282,6 @@ const MobileMenu: React.FC = () => {
<AiFillGithub size={20} />
</a>
</div>
<div className="flex-1 flex justify-center">
<div
onClick={onOpenPrompt}
className={cn(
"w-8 h-8 flex justify-center items-center cursor-pointer transition-colors rounded-md",
"hover:bg-gray-200/60",
"dark:hover:bg-slate-700/70"
)}
>
<HiLightBulb size={20} />
</div>
</div>
<Dropdown
selectable
options={lans}
Expand Down
2 changes: 1 addition & 1 deletion src/components/prompt/add/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ const Add = React.forwardRef((_, forwardedRef) => {
onClose={onClose}
onOk={onOk}
>
<div className="flex flex-col gap-3">
<div className="flex flex-col gap-4">
<div>
<div className="text-sm mb-1">{t("title")}</div>
<div className="flex gap-2 items-center">
Expand Down
28 changes: 14 additions & 14 deletions src/components/prompt/market/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,35 +130,35 @@ const PromptMarket: React.FC = () => {
footer={null}
>
<Tabs.Root value={type} onValueChange={onChangeTab}>
<div className="flex mb-2 justify-between items-center">
<div className="flex gap-4 mb-2 justify-between items-center">
<Tabs.List
className={cn(
"rounded-md flex text-sm w-auto p-1 text-[hsl(215.4,16.3%,56.9%)]",
"flex-1 flex rounded-md text-sm w-auto p-1 text-[hsl(215.4,16.3%,56.9%)]",
"bg-neutral-200/70 dark:bg-slate-900"
)}
>
<Tabs.Trigger
value="market"
className={cn(
"rounded-md py-1.5 px-3 transition-colors",
"rounded-md py-1.5 px-3 transition-colors flex-1",
"data-[state=active]:bg-white data-[state=active]:text-neutral-950",
"dark:data-[state=active]:bg-slate-700 dark:data-[state=active]:text-[hsl(213,31%,91%)]"
)}
>
<div className="flex gap-2 items-center">
<div className="flex gap-2 items-center justify-center">
<LuStore size={16} />
<span className="hidden lg:block">{t("market")}</span>
</div>
</Tabs.Trigger>
<Tabs.Trigger
value="awesome-chatgpt-prompts"
className={cn(
"rounded-md py-1.5 px-3 transition-colors",
"rounded-md py-1.5 px-3 transition-colors flex-1",
"data-[state=active]:bg-white data-[state=active]:text-neutral-950",
"dark:data-[state=active]:bg-slate-700 dark:data-[state=active]:text-[hsl(213,31%,91%)]"
)}
>
<div className="flex gap-2 items-center">
<div className="flex gap-2 items-center justify-center">
<MdOutlineAutoAwesome size={16} />
<span className="hidden lg:block">
Awesome ChatGPT Prompts
Expand All @@ -170,25 +170,25 @@ const PromptMarket: React.FC = () => {
<Tabs.Trigger
value="custom"
className={cn(
"rounded-md py-1.5 px-3 transition-colors",
"rounded-md py-1.5 px-3 transition-colors flex-1",
"data-[state=active]:bg-white data-[state=active]:text-neutral-950",
"dark:data-[state=active]:bg-slate-700 dark:data-[state=active]:text-[hsl(213,31%,91%)]"
)}
>
<div className="flex gap-2 items-center">
<div className="flex gap-2 items-center justify-center">
<BiCustomize size={16} />
<span className="hidden lg:block">{t("custom")}</span>
</div>
</Tabs.Trigger>
<Tabs.Trigger
value="review"
className={cn(
"rounded-md py-1.5 px-3 transition-colors",
"rounded-md py-1.5 px-3 transition-colors flex-1",
"data-[state=active]:bg-white data-[state=active]:text-neutral-950",
"dark:data-[state=active]:bg-slate-700 dark:data-[state=active]:text-[hsl(213,31%,91%)]"
)}
>
<div className="flex gap-2 items-center">
<div className="flex gap-2 items-center justify-center">
<SiCodereview size={16} />
<span className="hidden lg:block">
{t("under-review")}
Expand All @@ -198,13 +198,13 @@ const PromptMarket: React.FC = () => {
</>
)}
</Tabs.List>
<div className="flex gap-2">
{type === "custom" && (
{type === "custom" && (
<div className="flex gap-2">
<Button type="primary" onClick={onAdd}>
{tCommon("add")}
</Button>
)}
</div>
</div>
)}
</div>
<Tabs.Content
value="market"
Expand Down
1 change: 1 addition & 0 deletions src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
"model": "Model",
"no-data": "No Data",
"prompt-market": "Prompt Market",
"recently-used": "Recently used",
"release": "Release",
"release-prompt": "Release Prompt",
"release-success": "Release successfully",
Expand Down
1 change: 1 addition & 0 deletions src/locales/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
"model": "语言模型",
"no-data": "暂无数据",
"prompt-market": "Prompt 集市",
"recently-used": "最近使用",
"release": "发布",
"release-prompt": "发布 Prompt",
"release-success": "发布成功",
Expand Down
41 changes: 0 additions & 41 deletions src/prompt/default.ts

This file was deleted.

5 changes: 0 additions & 5 deletions src/prompt/index.ts

This file was deleted.

Empty file removed src/prompt/market.ts
Empty file.
8 changes: 0 additions & 8 deletions src/prompt/types.ts

This file was deleted.

1 comment on commit 91875fd

@vercel
Copy link

@vercel vercel bot commented on 91875fd Jun 10, 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.