fix: update search for

Signed-off-by: Innei <i@innei.in>
This commit is contained in:
Innei 2024-09-21 22:42:01 +08:00
parent cf9285b40e
commit b51d75ffc9
No known key found for this signature in database
GPG Key ID: 0F62D33977F021F7
4 changed files with 39 additions and 18 deletions

View File

@ -206,11 +206,15 @@ export function DiscoverForm({ type }: { type: string }) {
control={form.control}
name="target"
render={({ field }) => (
<FormItem className="!mt-4">
<FormItem className="!mt-4 flex items-center justify-between">
<FormLabel>{t("discover.target")}</FormLabel>
<FormControl>
<div className="flex gap-6">
<RadioGroup value={field.value} onValueChange={handleTargetChange}>
<div className="flex gap-4 text-sm">
<RadioGroup
className="flex items-center"
value={field.value}
onValueChange={handleTargetChange}
>
<Radio label={t("discover.target.feeds")} value="feeds" />
<Radio label={t("discover.target.lists")} value="lists" />
</RadioGroup>

View File

@ -1,6 +1,7 @@
import { m } from "framer-motion"
import type { FC, PropsWithChildren } from "react"
import { memo, useCallback, useEffect, useRef, useState } from "react"
import { useHotkeys } from "react-hotkeys-hook"
import { useTranslation } from "react-i18next"
import { Link } from "react-router-dom"
import { toast } from "sonner"
@ -65,7 +66,7 @@ export const FeedColumnHeader = memo(() => {
<i className="i-mgc-compass-3-cute-re size-5 text-theme-vibrancyFg" />
</ActionButton>
</Link>
<SearchActionButton />
<SearchTrigger />
<ProfileButton method="modal" />
<LayoutActionButton />
@ -145,17 +146,33 @@ const LogoContextMenu: FC<PropsWithChildren> = ({ children }) => {
)
}
const SearchActionButton = () => {
// const SearchActionButton = () => {
// const canSearch = useGeneralSettingKey("dataPersist")
// const { t } = useTranslation()
// if (!canSearch) return null
// return (
// <ActionButton
// shortcut="Meta+K"
// tooltip={t("words.search")}
// onClick={() => setAppSearchOpen(true)}
// >
// <i className="i-mgc-search-2-cute-re size-5 text-theme-vibrancyFg" />
// </ActionButton>
// )
// }
const SearchTrigger = () => {
const canSearch = useGeneralSettingKey("dataPersist")
const { t } = useTranslation()
if (!canSearch) return null
return (
<ActionButton
shortcut="Meta+K"
tooltip={t("words.search")}
onClick={() => setAppSearchOpen(true)}
>
<i className="i-mgc-search-2-cute-re size-5 text-theme-vibrancyFg" />
</ActionButton>
useHotkeys(
"meta+k",
() => {
setAppSearchOpen(true)
},
{
enabled: canSearch,
},
)
return null
}

View File

@ -136,7 +136,7 @@ function FeedListImpl({ className, view }: { className?: string; view: number })
<ScrollArea.ScrollArea mask={false} flex viewportClassName="!px-3" rootClassName="h-full">
<div
className={cn(
"mt-1 flex h-8 w-full shrink-0 cursor-menu items-center gap-1 rounded-md px-2.5 transition-colors",
"mt-1 flex h-8 w-full shrink-0 cursor-menu items-center gap-2 rounded-md px-2.5 transition-colors",
feedId === FEED_COLLECTION_LIST && "bg-native-active",
)}
onClick={(e) => {
@ -150,7 +150,7 @@ function FeedListImpl({ className, view }: { className?: string; view: number })
}
}}
>
<i className="i-mgc-star-cute-fi mr-2 size-4 -translate-y-px text-amber-500" />
<i className="i-mgc-star-cute-fi size-4 -translate-y-px text-amber-500" />
{t("words.starred")}
</div>
{Object.keys(listsData).length > 0 && (

View File

@ -14,7 +14,7 @@
"discover.rss_hub_route": "RSSHub Route",
"discover.rss_url": "RSS URL",
"discover.select_placeholder": "Select",
"discover.target": "Type",
"discover.target": "Search for",
"discover.target.feeds": "Feeds",
"discover.target.lists": "Lists",
"early_access": "Early Access",