From 91cc97be66e21b64e8ace9e8e6869c66e6314cc1 Mon Sep 17 00:00:00 2001 From: Pham Ngoc Duong Date: Thu, 9 Jan 2025 22:02:24 +0700 Subject: [PATCH] style: improve consistency on font weight & scrollbar --- package.json | 3 +- pnpm-lock.yaml | 53 ++++++ src/components/CodeHighlighter.tsx | 19 ++- src/components/Tooltip.tsx | 3 +- src/components/ui/dialog.tsx | 2 +- src/components/ui/scroll-area.tsx | 49 ++++++ .../plugin-details/PluginDetailsModal.tsx | 2 +- .../plugin-details/content/Canvas.tsx | 13 +- src/features/plugins/command-menu/Wrapper.tsx | 4 +- .../command-menu/components/BaseItem.tsx | 2 + .../space-search-items/SpaceItem.tsx | 2 +- .../thread-search-items/ThreadItem.tsx | 2 +- .../ImageGenModelSelector.tsx | 3 +- .../query-box/focus-selector/Wrapper.tsx | 11 ++ .../components/DesktopSelectContent.tsx | 2 +- .../components/MobileSelectContent.tsx | 2 +- .../FocusWebRecencySelector.tsx | 7 +- .../focus-web-recency/FollowUpWrapper.tsx | 6 +- .../components/DesktopSelectContent.tsx | 2 +- .../components/MobileSelectContent.tsx | 2 +- .../components/DesktopSelectContent.tsx | 2 +- .../components/MobileSelectContent.tsx | 2 +- .../components/ModelTrigger.tsx | 2 +- .../prompt-history/PromptHistoryItem.tsx | 2 +- .../plugins/query-box/shared-store.ts | 32 ---- .../query-box/slash-command-menu/Wrapper.tsx | 3 +- .../query-box/space-navigator/SpaceItem.tsx | 153 +++++++++--------- .../space-navigator/SpaceNavigatorContent.tsx | 7 + .../CopyButton.tsx | 2 +- .../explicit-model-name.ts | 2 +- .../simplify-rewrite-dropdown.css | 3 +- .../words-and-characters-count.ts | 4 +- .../canvas/components/CanvasContent.tsx | 2 +- .../thread/canvas/components/CodeView.tsx | 2 +- .../PrePromptInstallationDialog.tsx | 19 ++- .../thread/export-thread/ExportButton.tsx | 4 +- src/services/cs-loader-registry.ts | 3 +- src/services/pplx-api/pplx-api.ts | 6 +- src/utils/dom-selectors.ts | 3 +- 39 files changed, 280 insertions(+), 162 deletions(-) create mode 100644 src/components/ui/scroll-area.tsx diff --git a/package.json b/package.json index 19b86358..cf1a8815 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "complexity", "displayName": "Complexity - Perplexity AI Supercharged", - "version": "1.2.6.0", + "version": "1.2.7.0", "author": "pnd280", "description": "⚡ Supercharge your Perplexity AI", "type": "module", @@ -36,6 +36,7 @@ "@hookform/resolvers": "^3.10.0", "@lukemorales/query-key-factory": "^1.3.4", "@radix-ui/react-collapsible": "^1.1.2", + "@radix-ui/react-scroll-area": "^1.2.2", "@radix-ui/react-slot": "^1.1.1", "@radix-ui/react-toast": "^1.2.4", "@tanstack/react-query": "^5.62.16", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 403f6565..612f43a7 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -29,6 +29,9 @@ importers: '@radix-ui/react-collapsible': specifier: ^1.1.2 version: 1.1.2(@types/react-dom@19.0.2(@types/react@19.0.3))(@types/react@19.0.3)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) + '@radix-ui/react-scroll-area': + specifier: ^1.2.2 + version: 1.2.2(@types/react-dom@19.0.2(@types/react@19.0.3))(@types/react@19.0.3)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) '@radix-ui/react-slot': specifier: ^1.1.1 version: 1.1.1(@types/react@19.0.3)(react@19.0.0) @@ -861,6 +864,9 @@ packages: '@polka/url@1.0.0-next.28': resolution: {integrity: sha512-8LduaNlMZGwdZ6qWrKlfa+2M4gahzFkprZiAt2TF8uS0qQgBizKXpXURqvTJ4WtmupWxaLqjRb2UCTe72mu+Aw==} + '@radix-ui/number@1.1.0': + resolution: {integrity: sha512-V3gRzhVNU1ldS5XhAPTom1fOIo4ccrjjJgmE+LI2h/WaFpHmx0MQApT+KZHnx8abG6Avtfcz4WoEciMnpFT3HQ==} + '@radix-ui/primitive@1.1.1': resolution: {integrity: sha512-SJ31y+Q/zAyShtXJc8x83i9TYdbAfHZ++tUZnvjJJqFjzsdUnKsxPL6IEtBlxKkU7yzer//GQtZSV4GbldL3YA==} @@ -921,6 +927,15 @@ packages: '@types/react-dom': optional: true + '@radix-ui/react-direction@1.1.0': + resolution: {integrity: sha512-BUuBvgThEiAXh2DWu93XsT+a3aWrGqolGlqqw5VU1kG7p/ZH2cuDlM1sRLNnY3QcBS69UIz2mcKhMxDsdewhjg==} + peerDependencies: + '@types/react': '*' + react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc + peerDependenciesMeta: + '@types/react': + optional: true + '@radix-ui/react-dismissable-layer@1.1.3': resolution: {integrity: sha512-onrWn/72lQoEucDmJnr8uczSNTujT0vJnA/X5+3AkChVPowr8n1yvIKIabhWyMQeMvvmdpsvcyDqx3X1LEXCPg==} peerDependencies: @@ -1004,6 +1019,19 @@ packages: '@types/react-dom': optional: true + '@radix-ui/react-scroll-area@1.2.2': + resolution: {integrity: sha512-EFI1N/S3YxZEW/lJ/H1jY3njlvTd8tBmgKEn4GHi51+aMm94i6NmAJstsm5cu3yJwYqYc93gpCPm21FeAbFk6g==} + peerDependencies: + '@types/react': '*' + '@types/react-dom': '*' + react: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc + react-dom: ^16.8 || ^17.0 || ^18.0 || ^19.0 || ^19.0.0-rc + peerDependenciesMeta: + '@types/react': + optional: true + '@types/react-dom': + optional: true + '@radix-ui/react-slot@1.1.1': resolution: {integrity: sha512-RApLLOcINYJA+dMVbOju7MYv1Mb2EBp2nH4HdDzXTSyaR5optlm6Otrz1euW3HbdOR8UmmFK06TD+A9frYWv+g==} peerDependencies: @@ -6440,6 +6468,8 @@ snapshots: '@polka/url@1.0.0-next.28': {} + '@radix-ui/number@1.1.0': {} + '@radix-ui/primitive@1.1.1': {} '@radix-ui/react-collapsible@1.1.2(@types/react-dom@19.0.2(@types/react@19.0.3))(@types/react@19.0.3)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)': @@ -6504,6 +6534,12 @@ snapshots: '@types/react': 19.0.3 '@types/react-dom': 19.0.2(@types/react@19.0.3) + '@radix-ui/react-direction@1.1.0(@types/react@19.0.3)(react@19.0.0)': + dependencies: + react: 19.0.0 + optionalDependencies: + '@types/react': 19.0.3 + '@radix-ui/react-dismissable-layer@1.1.3(@types/react-dom@19.0.2(@types/react@19.0.3))(@types/react@19.0.3)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)': dependencies: '@radix-ui/primitive': 1.1.1 @@ -6570,6 +6606,23 @@ snapshots: '@types/react': 19.0.3 '@types/react-dom': 19.0.2(@types/react@19.0.3) + '@radix-ui/react-scroll-area@1.2.2(@types/react-dom@19.0.2(@types/react@19.0.3))(@types/react@19.0.3)(react-dom@19.0.0(react@19.0.0))(react@19.0.0)': + dependencies: + '@radix-ui/number': 1.1.0 + '@radix-ui/primitive': 1.1.1 + '@radix-ui/react-compose-refs': 1.1.1(@types/react@19.0.3)(react@19.0.0) + '@radix-ui/react-context': 1.1.1(@types/react@19.0.3)(react@19.0.0) + '@radix-ui/react-direction': 1.1.0(@types/react@19.0.3)(react@19.0.0) + '@radix-ui/react-presence': 1.1.2(@types/react-dom@19.0.2(@types/react@19.0.3))(@types/react@19.0.3)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) + '@radix-ui/react-primitive': 2.0.1(@types/react-dom@19.0.2(@types/react@19.0.3))(@types/react@19.0.3)(react-dom@19.0.0(react@19.0.0))(react@19.0.0) + '@radix-ui/react-use-callback-ref': 1.1.0(@types/react@19.0.3)(react@19.0.0) + '@radix-ui/react-use-layout-effect': 1.1.0(@types/react@19.0.3)(react@19.0.0) + react: 19.0.0 + react-dom: 19.0.0(react@19.0.0) + optionalDependencies: + '@types/react': 19.0.3 + '@types/react-dom': 19.0.2(@types/react@19.0.3) + '@radix-ui/react-slot@1.1.1(@types/react@19.0.3)(react@19.0.0)': dependencies: '@radix-ui/react-compose-refs': 1.1.1(@types/react@19.0.3)(react@19.0.0) diff --git a/src/components/CodeHighlighter.tsx b/src/components/CodeHighlighter.tsx index ee8e0069..4d42667e 100644 --- a/src/components/CodeHighlighter.tsx +++ b/src/components/CodeHighlighter.tsx @@ -1,18 +1,13 @@ import { ComponentProps } from "react"; -import SyntaxHighlighter from "react-syntax-highlighter"; -import lightStyle from "react-syntax-highlighter/dist/esm/styles/hljs/vs"; -import darkStyle from "react-syntax-highlighter/dist/esm/styles/hljs/vs2015"; +import { Prism as SyntaxHighlighter } from "react-syntax-highlighter"; +import lightStyle from "react-syntax-highlighter/dist/esm/styles/prism/vs"; +import darkStyle from "react-syntax-highlighter/dist/esm/styles/prism/vsc-dark-plus"; import { useColorSchemeStore } from "@/data/color-scheme-store"; const INTERPRETED_LANGUAGES: Record = { - html: "xml", - react: "javascript", - jsx: "javascript", - tsx: "typescript", - js: "javascript", - ts: "typescript", - py: "python", + html: "markup", + react: "jsx", }; const CodeHighlighter = memo(function CodeHighlighter({ @@ -35,6 +30,10 @@ const CodeHighlighter = memo(function CodeHighlighter({ return ( diff --git a/src/components/Tooltip.tsx b/src/components/Tooltip.tsx index 70a435d9..99f09a99 100644 --- a/src/components/Tooltip.tsx +++ b/src/components/Tooltip.tsx @@ -28,6 +28,7 @@ export default function Tooltip({ }: TooltipProps) { return ( {!(typeof content === "string" && content.length === 0) && ( -
{content}
+
{content}
)}
diff --git a/src/components/ui/dialog.tsx b/src/components/ui/dialog.tsx index f7fa6e3e..f517d12d 100644 --- a/src/components/ui/dialog.tsx +++ b/src/components/ui/dialog.tsx @@ -46,7 +46,7 @@ const DialogContent = ({ ) => ( + + + {children} + + + + + +); + +ScrollArea.displayName = ScrollAreaPrimitive.Root.displayName; + +const ScrollBar = ({ + className, + orientation = "vertical", + ...props +}: ComponentProps) => ( + + + +); + +ScrollBar.displayName = ScrollAreaPrimitive.ScrollAreaScrollbar.displayName; + +export { ScrollArea, ScrollBar }; diff --git a/src/features/options-page/dashboard/pages/plugins/components/plugin-details/PluginDetailsModal.tsx b/src/features/options-page/dashboard/pages/plugins/components/plugin-details/PluginDetailsModal.tsx index 19b69cfa..8edad030 100644 --- a/src/features/options-page/dashboard/pages/plugins/components/plugin-details/PluginDetailsModal.tsx +++ b/src/features/options-page/dashboard/pages/plugins/components/plugin-details/PluginDetailsModal.tsx @@ -45,7 +45,7 @@ export default function PluginDetailsModal({ {PLUGINS_METADATA[pluginId].description} - {PLUGIN_DETAILS[pluginId]} +
{PLUGIN_DETAILS[pluginId]}
); diff --git a/src/features/options-page/dashboard/pages/plugins/components/plugin-details/content/Canvas.tsx b/src/features/options-page/dashboard/pages/plugins/components/plugin-details/content/Canvas.tsx index ee9c77e8..ae91850a 100644 --- a/src/features/options-page/dashboard/pages/plugins/components/plugin-details/content/Canvas.tsx +++ b/src/features/options-page/dashboard/pages/plugins/components/plugin-details/content/Canvas.tsx @@ -7,7 +7,7 @@ export default function CanvasPluginDetails() { const { settings, mutation } = useExtensionLocalStorage(); return ( -
+
+ + + Supported language models + + + any + + + Claude 3.5 Sonnet, GPT-4o, GPT-o1, Sonar Huge, Grok-2 + + Ease of use diff --git a/src/features/plugins/command-menu/Wrapper.tsx b/src/features/plugins/command-menu/Wrapper.tsx index cb71cc66..49ec8b9c 100644 --- a/src/features/plugins/command-menu/Wrapper.tsx +++ b/src/features/plugins/command-menu/Wrapper.tsx @@ -89,7 +89,9 @@ export default function CommandMenuWrapper() { { onSelect?.(); if (closeOnSelect) closeCommandMenu(); diff --git a/src/features/plugins/command-menu/components/space-search-items/SpaceItem.tsx b/src/features/plugins/command-menu/components/space-search-items/SpaceItem.tsx index c8b0b9bd..8e3b5007 100644 --- a/src/features/plugins/command-menu/components/space-search-items/SpaceItem.tsx +++ b/src/features/plugins/command-menu/components/space-search-items/SpaceItem.tsx @@ -46,7 +46,7 @@ export function SpaceItem({ space }: SpaceItemProps) { value={space.uuid} keywords={[searchKeyword]} className={cn( - "tw-flex tw-min-h-10 tw-items-center", + "tw-flex tw-min-h-10 tw-items-center tw-font-medium", isHighlighted && "tw-h-max", )} onSelect={() => { diff --git a/src/features/plugins/command-menu/components/thread-search-items/ThreadItem.tsx b/src/features/plugins/command-menu/components/thread-search-items/ThreadItem.tsx index 7232bdeb..729857df 100644 --- a/src/features/plugins/command-menu/components/thread-search-items/ThreadItem.tsx +++ b/src/features/plugins/command-menu/components/thread-search-items/ThreadItem.tsx @@ -19,7 +19,7 @@ export function ThreadItem({ thread }: ThreadItemProps) { key={thread.slug} asChild value={thread.slug} - className="tw-flex tw-h-10 tw-items-center tw-justify-between tw-gap-8" + className="tw-flex tw-h-10 tw-items-center tw-justify-between tw-gap-8 tw-font-medium" onSelect={() => { if (isHotkeyPressed("ctrl")) return window.open(`/search/${thread.slug}`, "_blank"); diff --git a/src/features/plugins/image-gen-popover/ImageGenModelSelector.tsx b/src/features/plugins/image-gen-popover/ImageGenModelSelector.tsx index b68642e5..95e48f84 100644 --- a/src/features/plugins/image-gen-popover/ImageGenModelSelector.tsx +++ b/src/features/plugins/image-gen-popover/ImageGenModelSelector.tsx @@ -53,7 +53,7 @@ export default function ImageGenModelSelector() {
- + {imageGenModels.find((model) => model.code === value)?.shortLabel} @@ -77,6 +77,7 @@ export default function ImageGenModelSelector() { { e.stopPropagation(); }} diff --git a/src/features/plugins/query-box/focus-selector/Wrapper.tsx b/src/features/plugins/query-box/focus-selector/Wrapper.tsx index 7634df54..97bb1f21 100644 --- a/src/features/plugins/query-box/focus-selector/Wrapper.tsx +++ b/src/features/plugins/query-box/focus-selector/Wrapper.tsx @@ -1,4 +1,5 @@ import { createListCollection, SelectContext } from "@ark-ui/react"; +import { sendMessage } from "webext-bridge/content-script"; import Tooltip from "@/components/Tooltip"; import { Select, SelectTrigger, SelectValue } from "@/components/ui/select"; @@ -34,6 +35,16 @@ export default function FocusSelectorWrapper() { FOCUS_MODES.find((mode) => mode.code === selectedFocusMode) ?? FOCUS_MODES[0]!; + useEffect(() => { + sendMessage( + "reactVdom:setFocusMode", + { + focusMode: selectedFocusMode, + }, + "window", + ); + }, [selectedFocusMode]); + return (