diff --git a/enjoy/src/index.css b/enjoy/src/index.css index 3ce30f83..35e7da11 100644 --- a/enjoy/src/index.css +++ b/enjoy/src/index.css @@ -96,4 +96,7 @@ body { user-select: none; + :focus-visible { + outline: none; + } } diff --git a/enjoy/src/renderer/components/meanings/meaning-memorizing-card.tsx b/enjoy/src/renderer/components/meanings/meaning-memorizing-card.tsx index 775ea2ea..0050177c 100644 --- a/enjoy/src/renderer/components/meanings/meaning-memorizing-card.tsx +++ b/enjoy/src/renderer/components/meanings/meaning-memorizing-card.tsx @@ -46,17 +46,21 @@ const FrontSide = (props: { return (
-

{word}

-
-
{t("context")}
-
- -
- {lookups.map((lookup) => ( -

- {lookup.context} -

- ))} + +

+ {word} +

+
+
{t("context")}
+
+
+
+ {lookups.map((lookup) => ( +

+ {lookup.context} +

+ ))} +
@@ -102,38 +106,42 @@ const BackSide = (props: { meaning: MeaningType; onFlip: () => void }) => { return (
-

{word}

-
-
- {pos && ( - - {pos} - - )} - {pronunciation && ( - /{pronunciation}/ - )} - {lemma && lemma !== word && ( - ({lemma}) - )} -
- {translation &&
{translation}
} -
- {definition} + +

+ {word} +

+
+
+ {pos && ( + + {pos} + + )} + {pronunciation && ( + /{pronunciation}/ + )} + {lemma && lemma !== word && ( + ({lemma}) + )} +
+ {translation &&
{translation}
} +
+ {definition} +
+ + +
{t("context")}
- -
{t("context")}
-
- - -
- {lookups.map((lookup) => ( -
-
{lookup.context}
-
{lookup.contextTranslation}
-
- ))} +
+
+ {lookups.map((lookup) => ( +
+
{lookup.context}
+
{lookup.contextTranslation}
+
+ ))} +
diff --git a/enjoy/src/renderer/components/medias/media-caption.tsx b/enjoy/src/renderer/components/medias/media-caption.tsx index d8fc11e5..f0cb0a50 100644 --- a/enjoy/src/renderer/components/medias/media-caption.tsx +++ b/enjoy/src/renderer/components/medias/media-caption.tsx @@ -1,7 +1,7 @@ import { useEffect, useState, useContext } from "react"; import { MediaPlayerProviderContext } from "@renderer/context"; import cloneDeep from "lodash/cloneDeep"; -import { Button, toast, ScrollArea } from "@renderer/components/ui"; +import { Button, toast } from "@renderer/components/ui"; import { ConversationShortcuts, MediaCaptionTabs } from "@renderer/components"; import { t } from "i18next"; import { BotIcon, CopyIcon, CheckIcon, SpeechIcon } from "lucide-react"; @@ -397,7 +397,22 @@ export const MediaCaption = () => { data-tooltip-id="media-player-tooltip" data-tooltip-content={t("copyText")} onClick={() => { - copyToClipboard(caption.text); + if (displayIpa) { + const text = caption.timeline + .map((word) => { + const ipa = word.timeline + .map((t) => + t.timeline.map((s) => convertIpaToNormal(s.text)).join("") + ) + .join(" ยท "); + return `${word.text}(${ipa})`; + }) + .join(" "); + + copyToClipboard(text); + } else { + copyToClipboard(caption.text); + } setCopied(true); setTimeout(() => { setCopied(false); diff --git a/enjoy/src/renderer/components/sidebar.tsx b/enjoy/src/renderer/components/sidebar.tsx index 3e679978..f7c74e21 100644 --- a/enjoy/src/renderer/components/sidebar.tsx +++ b/enjoy/src/renderer/components/sidebar.tsx @@ -4,6 +4,16 @@ import { DialogTrigger, DialogContent, ScrollArea, + DropdownMenu, + DropdownMenuTrigger, + DropdownMenuContent, + DropdownMenuGroup, + DropdownMenuSub, + DropdownMenuPortal, + DropdownMenuSubContent, + DropdownMenuSubTrigger, + DropdownMenuItem, + Separator, } from "@renderer/components/ui"; import { SettingsIcon, @@ -15,203 +25,112 @@ import { UserIcon, BotIcon, UsersRoundIcon, + LucideIcon, + HelpCircleIcon, + ExternalLinkIcon, } from "lucide-react"; import { useLocation, Link } from "react-router-dom"; import { t } from "i18next"; import { Preferences } from "@renderer/components"; +import { AppSettingsProviderContext } from "@renderer/context"; +import { useContext } from "react"; export const Sidebar = () => { const location = useLocation(); const activeTab = location.pathname; + const { EnjoyApp } = useContext(AppSettingsProviderContext); return (
-
+
-
+
ENJOY
-
-
- - - +
+ - - - + - - - -
-
+ -
-

- {t("sidebar.library")} -

-
- - - + - - - + - - - -
-
+ -
-

- {t("sidebar.mine")} -

-
- - - + - - - + - - + + + + + + + + + + +
- +
+
- - - -
-
+ + + +
+ +
+ + + + + + + + + EnjoyApp.shell.openExternal("https://1000h.org/enjoy-app/") + } + className="flex justify-between space-x-2" + > + {t("userGuide")} + + + + + + + + {t("feedback")} + + + + + EnjoyApp.shell.openExternal( + "https://mixin.one/codes/f8ff96b8-54fb-4ad8-a6d4-5a5bdb1df13e" + ) + } + className="flex justify-between space-x-2" + > + Mixin + + + + EnjoyApp.shell.openExternal( + "https://github.com/xiaolai/everyone-can-use-english/discussions" + ) + } + className="flex justify-between space-x-2" + > + Github + + + + + + + + +
); }; + +const SidebarItem = (props: { + href: string; + label: string; + tooltip: string; + active: boolean; + Icon: LucideIcon; +}) => { + const { href, label, tooltip, active, Icon } = props; + + return ( + + + + ); +}; diff --git a/enjoy/src/renderer/components/ui/button.tsx b/enjoy/src/renderer/components/ui/button.tsx index 2c37c414..187fa6b1 100644 --- a/enjoy/src/renderer/components/ui/button.tsx +++ b/enjoy/src/renderer/components/ui/button.tsx @@ -5,7 +5,7 @@ import { cva, type VariantProps } from "class-variance-authority" import { cn } from "@renderer/lib/utils" const buttonVariants = cva( - "capitalize inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-ring disabled:pointer-events-none disabled:opacity-50 min-w-fit", + "capitalize inline-flex items-center justify-center rounded-md text-sm font-medium transition-colors focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50 min-w-fit", { variants: { variant: { diff --git a/enjoy/src/renderer/components/ui/input.tsx b/enjoy/src/renderer/components/ui/input.tsx index cd76d93f..5552ab5e 100644 --- a/enjoy/src/renderer/components/ui/input.tsx +++ b/enjoy/src/renderer/components/ui/input.tsx @@ -11,7 +11,7 @@ const Input = React.forwardRef( - + )); Slider.displayName = SliderPrimitive.Root.displayName; diff --git a/enjoy/src/renderer/components/ui/switch.tsx b/enjoy/src/renderer/components/ui/switch.tsx index 51623e0f..9e76dc9e 100644 --- a/enjoy/src/renderer/components/ui/switch.tsx +++ b/enjoy/src/renderer/components/ui/switch.tsx @@ -11,7 +11,7 @@ const Switch = React.forwardRef< >(({ className, ...props }, ref) => ( ( return (