feat(ai): re-design ai subscription component
- Updated the version of `@folo-services/ai-tools` from `0.2.34` to `0.2.36` in `pnpm-lock.yaml` and `package.json`. - Updated the version of `@folo-services/drizzle` from `0.1.24` to `0.1.25` in `pnpm-lock.yaml`. - Refactored the `AIDisplaySubscriptionsPart` component to streamline the rendering of subscription items and improve navigation handling. - Removed unused code and optimized the component structure for better maintainability. This update enhances the AI tools integration and improves the user experience in the AI display component. Signed-off-by: Innei <tukon479@gmail.com>
This commit is contained in:
@@ -121,7 +121,7 @@
|
||||
"@follow/models": "workspace:*",
|
||||
"@follow/types": "workspace:*",
|
||||
"@follow/utils": "workspace:*",
|
||||
"@folo-services/ai-tools": "0.2.34",
|
||||
"@folo-services/ai-tools": "0.2.36",
|
||||
"@types/node": "24.0.10",
|
||||
"@vite-pwa/assets-generator": "1.0.0",
|
||||
"fake-indexeddb": "6.0.1",
|
||||
|
||||
+68
-221
@@ -1,240 +1,87 @@
|
||||
import {
|
||||
Card,
|
||||
CardContent,
|
||||
CardDescription,
|
||||
CardHeader,
|
||||
CardTitle,
|
||||
} from "@follow/components/ui/card/index.js"
|
||||
import { views } from "@follow/constants"
|
||||
import dayjs from "dayjs"
|
||||
import { memo, useCallback } from "react"
|
||||
import { useTranslation } from "react-i18next"
|
||||
|
||||
import { useNavigateEntry } from "~/hooks/biz/useNavigateEntry"
|
||||
import { FeedIcon } from "~/modules/feed/feed-icon"
|
||||
|
||||
import type { AIDisplaySubscriptionsTool } from "../../store/types"
|
||||
import { DisplayCardWrapper, withDisplayStateHandler } from "./share"
|
||||
import { AnalyticsMetrics, CategoryTag, EmptyState, StatCard } from "./shared"
|
||||
import { withDisplayStateHandler } from "./share"
|
||||
|
||||
type SubscriptionData = AIDisplaySubscriptionsTool["output"]["subscriptions"]
|
||||
|
||||
const formatDisplayType = (displayType: string) => {
|
||||
const displayTypeMap = {
|
||||
list: "List View",
|
||||
grid: "Grid View",
|
||||
card: "Card View",
|
||||
compact: "Compact View",
|
||||
}
|
||||
return displayTypeMap[displayType as keyof typeof displayTypeMap] || displayType
|
||||
}
|
||||
|
||||
const formatGroupBy = (groupBy: string) => {
|
||||
const groupByMap = {
|
||||
category: "By Category",
|
||||
status: "By Status",
|
||||
none: "No Grouping",
|
||||
}
|
||||
return groupByMap[groupBy as keyof typeof groupByMap] || groupBy
|
||||
}
|
||||
|
||||
const formatFilterBy = (filterBy: string) => {
|
||||
const filterByMap = {
|
||||
all: "All Subscriptions",
|
||||
active: "Active Only",
|
||||
inactive: "Inactive Only",
|
||||
recent: "Recent (30 days)",
|
||||
}
|
||||
return filterByMap[filterBy as keyof typeof filterByMap] || filterBy
|
||||
}
|
||||
|
||||
const SubscriptionsGrid = ({
|
||||
data,
|
||||
showAnalytics,
|
||||
showCategories,
|
||||
}: {
|
||||
data: SubscriptionData
|
||||
showAnalytics: boolean
|
||||
showCategories: boolean
|
||||
}) => {
|
||||
if (!data?.length) {
|
||||
return <EmptyState message="No subscriptions found" />
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="@[600px]:grid-cols-3 @[400px]:grid-cols-2 grid grid-cols-1 gap-4">
|
||||
{data.map((sub) => (
|
||||
<Card
|
||||
key={`${sub.subscription?.userId}-${sub.subscription?.feedId}`}
|
||||
className="hover:bg-fill-tertiary cursor-pointer p-4"
|
||||
>
|
||||
<CardHeader className="h-24 px-2 py-3">
|
||||
<div className="flex items-start gap-3">
|
||||
<FeedIcon
|
||||
feed={sub.feed ? { ...sub.feed, type: "feed" as const } : null}
|
||||
size={32}
|
||||
className="shrink-0"
|
||||
noMargin
|
||||
/>
|
||||
<div className="-mt-1 min-w-0 flex-1">
|
||||
<CardTitle className="line-clamp-2 text-base">
|
||||
{sub.feed?.title || sub.subscription?.title || "Unknown Feed"}
|
||||
</CardTitle>
|
||||
{sub.feed?.description && (
|
||||
<CardDescription className="mt-1 line-clamp-2 text-xs">
|
||||
{sub.feed.description}
|
||||
</CardDescription>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
</CardHeader>
|
||||
|
||||
<CardContent className="space-y-3 p-0 px-2 pb-3">
|
||||
{showCategories && sub.subscription?.category && (
|
||||
<div>
|
||||
<CategoryTag category={sub.subscription.category} />
|
||||
</div>
|
||||
)}
|
||||
<div className="text-text-secondary text-xs">
|
||||
<span>
|
||||
Subscribed:{" "}
|
||||
<span>
|
||||
{sub.subscription?.createdAt
|
||||
? dayjs(sub.subscription.createdAt).format("MMM DD, YYYY")
|
||||
: "Unknown"}
|
||||
</span>
|
||||
</span>
|
||||
</div>
|
||||
{showAnalytics && (
|
||||
<AnalyticsMetrics
|
||||
metrics={[
|
||||
{ label: "Updates/Week", value: sub.analytics?.updatesPerWeek || 0 },
|
||||
{ label: "Views", value: sub.analytics?.view || sub.subscription?.view || 0 },
|
||||
]}
|
||||
/>
|
||||
)}
|
||||
</CardContent>
|
||||
</Card>
|
||||
))}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
const GroupedSubscriptions = ({
|
||||
data,
|
||||
groupBy,
|
||||
showAnalytics,
|
||||
showCategories,
|
||||
}: {
|
||||
data: SubscriptionData
|
||||
groupBy: string
|
||||
showAnalytics: boolean
|
||||
showCategories: boolean
|
||||
}) => {
|
||||
if (!data?.length || groupBy === "none") {
|
||||
return null
|
||||
}
|
||||
|
||||
const groups = data.reduce(
|
||||
(acc, sub) => {
|
||||
let key: string
|
||||
if (groupBy === "category") {
|
||||
key = sub.subscription?.category || "No Category"
|
||||
} else if (groupBy === "status") {
|
||||
// Simple status based on error state
|
||||
key = sub.feed?.errorMessage ? "Inactive" : "Active"
|
||||
} else {
|
||||
key = "All"
|
||||
}
|
||||
|
||||
if (!acc[key]) acc[key] = []
|
||||
acc[key]?.push(sub)
|
||||
return acc
|
||||
},
|
||||
{} as Record<string, SubscriptionData>,
|
||||
)
|
||||
|
||||
return (
|
||||
<div className="space-y-6">
|
||||
{Object.entries(groups).map(([groupName, groupData]) => (
|
||||
<div key={groupName}>
|
||||
<h3 className="text-text mb-4 text-lg font-semibold">{groupName}</h3>
|
||||
<SubscriptionsGrid
|
||||
data={groupData}
|
||||
showAnalytics={showAnalytics}
|
||||
showCategories={showCategories}
|
||||
/>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
type SingleSubscription = NonNullable<AIDisplaySubscriptionsTool["output"]>[number]
|
||||
|
||||
const AIDisplaySubscriptionsPartBase = ({
|
||||
output,
|
||||
}: {
|
||||
output: NonNullable<AIDisplaySubscriptionsTool["output"]>
|
||||
input: NonNullable<AIDisplaySubscriptionsTool["input"]>
|
||||
}) => {
|
||||
const {
|
||||
subscriptions,
|
||||
showAnalytics = true,
|
||||
showCategories = true,
|
||||
title,
|
||||
groupBy = "none",
|
||||
filterBy = "all",
|
||||
} = output
|
||||
const displayType = "displayType" in output ? (output.displayType as string) : "list"
|
||||
const navigateEntry = useNavigateEntry()
|
||||
|
||||
// Calculate statistics
|
||||
const totalSubscriptions = subscriptions.length
|
||||
const categoriesCount = new Set(
|
||||
subscriptions.map((s) => s.subscription?.category).filter(Boolean),
|
||||
).size
|
||||
const activeSubscriptions = subscriptions.filter((s) => !s.feed?.errorMessage).length
|
||||
const totalViews = subscriptions.reduce((acc, s) => acc + (s.subscription?.view || 0), 0)
|
||||
|
||||
const renderSubscriptions = () => {
|
||||
if (groupBy !== "none") {
|
||||
return (
|
||||
<GroupedSubscriptions
|
||||
data={subscriptions}
|
||||
groupBy={groupBy}
|
||||
showAnalytics={showAnalytics}
|
||||
showCategories={showCategories}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<SubscriptionsGrid
|
||||
data={subscriptions}
|
||||
showAnalytics={showAnalytics}
|
||||
showCategories={showCategories}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<DisplayCardWrapper
|
||||
title={title || "My Subscriptions"}
|
||||
emoji="📋"
|
||||
description={`${formatDisplayType(displayType)} • ${formatFilterBy(filterBy)} • ${formatGroupBy(groupBy)}`}
|
||||
>
|
||||
{/* Statistics Overview */}
|
||||
<div className="@[700px]:grid-cols-4 grid grid-cols-2 gap-4">
|
||||
<StatCard title="Total Subscriptions" value={totalSubscriptions} emoji="📊" />
|
||||
<StatCard
|
||||
title="Active Feeds"
|
||||
value={activeSubscriptions}
|
||||
description={`${totalSubscriptions - activeSubscriptions} inactive`}
|
||||
emoji="🟢"
|
||||
/>
|
||||
{showCategories && <StatCard title="Categories" value={categoriesCount} emoji="🏷️" />}
|
||||
<StatCard title="Total Views" value={totalViews.toLocaleString()} emoji="👀" />
|
||||
</div>
|
||||
|
||||
{/* Subscriptions Display */}
|
||||
{renderSubscriptions()}
|
||||
</DisplayCardWrapper>
|
||||
const handleClick = useCallback(
|
||||
(sub: SingleSubscription) => (e: React.MouseEvent) => {
|
||||
e.preventDefault()
|
||||
navigateEntry({ feedId: sub.feedId, view: sub.view })
|
||||
},
|
||||
[navigateEntry],
|
||||
)
|
||||
|
||||
return output.map((sub) => <Item key={sub.feedId} sub={sub} handleClick={handleClick} />)
|
||||
}
|
||||
|
||||
const Item = memo(
|
||||
({
|
||||
sub,
|
||||
handleClick,
|
||||
}: {
|
||||
sub: SingleSubscription
|
||||
handleClick: (sub: SingleSubscription) => (e: React.MouseEvent) => void
|
||||
}) => {
|
||||
const { feedId, title, image, siteUrl, category, subscribedAt, view } = sub
|
||||
const { t } = useTranslation()
|
||||
const currentView = views[view]
|
||||
if (currentView === undefined) {
|
||||
return null
|
||||
}
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
key={feedId}
|
||||
onClick={handleClick(sub)}
|
||||
className="bg-material-thick/80 border-border hover:bg-theme-item-hover group relative flex w-full flex-col items-start justify-start overflow-hidden rounded-lg border p-4 text-left backdrop-blur-sm transition-colors"
|
||||
>
|
||||
<div className="flex w-full items-start justify-between">
|
||||
<div className="flex">
|
||||
<FeedIcon
|
||||
disableFadeIn
|
||||
feed={{
|
||||
type: "feed",
|
||||
title,
|
||||
id: feedId,
|
||||
image,
|
||||
siteUrl,
|
||||
}}
|
||||
siteUrl={siteUrl!}
|
||||
/>
|
||||
<div className="flex min-w-0 flex-col">
|
||||
<h3 className="text-text line-clamp-2 font-semibold leading-tight">
|
||||
{title || "Untitled Feed"}
|
||||
</h3>
|
||||
<div className="text-text-tertiary mt-1 flex items-center gap-2 text-xs">
|
||||
{category ? <span className="text-text-secondary">{category}</span> : null}
|
||||
<span>Subscribed {dayjs(subscribedAt).format("MMM DD, YYYY")}</span>
|
||||
{currentView.icon}
|
||||
<span>{t(currentView.name, { ns: "common" })}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<i className="i-mgc-external-link-cute-re text-text-tertiary shrink-0 opacity-60 transition-opacity group-hover:opacity-100" />
|
||||
</div>
|
||||
</button>
|
||||
)
|
||||
},
|
||||
)
|
||||
export const AIDisplaySubscriptionsPart = withDisplayStateHandler<
|
||||
AIDisplaySubscriptionsTool["output"]
|
||||
>({
|
||||
|
||||
@@ -39,6 +39,7 @@ const getDisplayContent = (block: AIChatContextBlock): React.ReactNode => {
|
||||
}
|
||||
return getFileDisplayContent(block.attachment)
|
||||
}
|
||||
|
||||
default: {
|
||||
return ""
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
import { EventBus } from "@follow/utils/event-bus"
|
||||
import { useTranslation } from "react-i18next"
|
||||
|
||||
import { setAppSearchOpen } from "~/atoms/app"
|
||||
import { getAIPanelVisibility, setAIPanelVisibility } from "~/atoms/settings/ai"
|
||||
import { useShortcutsModal } from "~/modules/modal/hooks/useShortcutsModal"
|
||||
|
||||
import { useRegisterCommandEffect } from "../hooks/use-register-command"
|
||||
@@ -11,7 +13,6 @@ declare module "@follow/utils/event-bus" {
|
||||
interface EventBusMap {
|
||||
"global:toggle-corner-play": void
|
||||
"global:quick-add": void
|
||||
"global:toggle-ai-chat": void
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,9 +21,6 @@ export const useRegisterGlobalCommands = () => {
|
||||
const showShortcuts = useShortcutsModal()
|
||||
const { t } = useTranslation("shortcuts")
|
||||
|
||||
const aiIcon = (props?: { isActive?: boolean }) => {
|
||||
return <i className={props?.isActive ? "i-mgc-comment-cute-fi" : "i-mgc-comment-cute-re"} />
|
||||
}
|
||||
useRegisterCommandEffect([
|
||||
{
|
||||
id: COMMAND_ID.global.showShortcuts,
|
||||
@@ -59,6 +57,18 @@ export const useRegisterGlobalCommands = () => {
|
||||
category,
|
||||
},
|
||||
|
||||
{
|
||||
id: COMMAND_ID.global.quickSearch,
|
||||
label: {
|
||||
title: t("command.global.quick_search.title"),
|
||||
description: t("command.global.quick_search.description"),
|
||||
},
|
||||
run: () => {
|
||||
setAppSearchOpen(true)
|
||||
},
|
||||
category,
|
||||
},
|
||||
|
||||
{
|
||||
id: COMMAND_ID.global.toggleAIChat,
|
||||
label: {
|
||||
@@ -66,9 +76,10 @@ export const useRegisterGlobalCommands = () => {
|
||||
description: t("command.global.toggle_ai_chat.description"),
|
||||
},
|
||||
run: () => {
|
||||
EventBus.dispatch(COMMAND_ID.global.toggleAIChat)
|
||||
const isVisible = getAIPanelVisibility()
|
||||
setAIPanelVisibility(!isVisible)
|
||||
},
|
||||
icon: aiIcon,
|
||||
|
||||
category,
|
||||
},
|
||||
])
|
||||
@@ -94,8 +105,14 @@ export type ToggleAIChatCommand = Command<{
|
||||
fn: (ctx?: { entryId?: string }) => void
|
||||
}>
|
||||
|
||||
export type QuickSearchCommand = Command<{
|
||||
id: typeof COMMAND_ID.global.quickSearch
|
||||
fn: () => void
|
||||
}>
|
||||
|
||||
export type GlobalCommand =
|
||||
| ShowShortcutsCommand
|
||||
| ToggleCornerPlayCommand
|
||||
| QuickAddCommand
|
||||
| ToggleAIChatCommand
|
||||
| QuickSearchCommand
|
||||
|
||||
@@ -50,6 +50,7 @@ export const COMMAND_ID = {
|
||||
toggleCornerPlay: "global:toggle-corner-play",
|
||||
quickAdd: "global:quick-add",
|
||||
toggleAIChat: "global:toggle-ai-chat",
|
||||
quickSearch: "global:quick-search",
|
||||
},
|
||||
layout: {
|
||||
toggleSubscriptionColumn: "layout:toggle-subscription-column",
|
||||
|
||||
@@ -53,6 +53,7 @@ export const defaultCommandShortcuts = {
|
||||
[COMMAND_ID.global.quickAdd]: transformShortcut("$mod+N"),
|
||||
[COMMAND_ID.global.showShortcuts]: "?",
|
||||
[COMMAND_ID.global.toggleAIChat]: transformShortcut("$mod+I"),
|
||||
[COMMAND_ID.global.quickSearch]: transformShortcut("$mod+K"),
|
||||
} as const
|
||||
|
||||
const overrideCommandShortcutsAtom = atomWithStorage<
|
||||
@@ -105,8 +106,6 @@ export const allowCustomizeCommands = new Set([
|
||||
COMMAND_ID.entry.star,
|
||||
COMMAND_ID.entry.tip,
|
||||
COMMAND_ID.entry.tts,
|
||||
|
||||
COMMAND_ID.global.toggleAIChat,
|
||||
] as const)
|
||||
type ExtractSetType<T extends Set<unknown>> = T extends Set<infer U> ? U : never
|
||||
export type AllowCustomizeCommandId = ExtractSetType<typeof allowCustomizeCommands>
|
||||
|
||||
@@ -62,10 +62,6 @@ const warningActionButton: Partial<
|
||||
show: !IN_ELECTRON,
|
||||
info: "entry_actions.warn_info_for_desktop",
|
||||
},
|
||||
[COMMAND_ID.global.toggleAIChat]: {
|
||||
show: true,
|
||||
info: "entry_actions.warn_info_ai_chat_pinned_tip",
|
||||
},
|
||||
}
|
||||
|
||||
export const SortableActionButton = ({ id }: { id: UniqueIdentifier }) => {
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { useGlobalFocusableScopeSelector } from "@follow/components/common/Focusable/hooks.js"
|
||||
import { Form, FormControl, FormField, FormItem } from "@follow/components/ui/form/index.jsx"
|
||||
import { useRegisterGlobalContext } from "@follow/shared/bridge"
|
||||
import { tracker } from "@follow/tracker"
|
||||
@@ -11,7 +10,6 @@ import { useTranslation } from "react-i18next"
|
||||
import { useEventCallback } from "usehooks-ts"
|
||||
import { z } from "zod"
|
||||
|
||||
import { FocusablePresets } from "~/components/common/Focusable"
|
||||
import { m } from "~/components/common/Motion"
|
||||
import { PlainModal } from "~/components/ui/modal/stacked/custom-modal"
|
||||
import { useModalStack } from "~/components/ui/modal/stacked/hooks"
|
||||
@@ -19,7 +17,6 @@ import { getRouteParams } from "~/hooks/biz/useRouteParams"
|
||||
import { ipcServices } from "~/lib/client"
|
||||
|
||||
import { COMMAND_ID } from "../command/commands/id"
|
||||
import { useCommandBinding } from "../command/hooks/use-command-binding"
|
||||
import { FeedForm } from "../discover/FeedForm"
|
||||
|
||||
const CmdNPanel = () => {
|
||||
@@ -117,11 +114,6 @@ export const CmdNTrigger = () => {
|
||||
})
|
||||
})
|
||||
|
||||
useCommandBinding({
|
||||
commandId: COMMAND_ID.global.quickAdd,
|
||||
when: useGlobalFocusableScopeSelector(FocusablePresets.isNotFloatingLayerScope),
|
||||
})
|
||||
|
||||
useEffect(() => {
|
||||
return EventBus.subscribe(COMMAND_ID.global.quickAdd, handler)
|
||||
}, [handler])
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { useGlobalFocusableScopeSelector } from "@follow/components/common/Focusable/index.js"
|
||||
import { Spring } from "@follow/components/constants/spring.js"
|
||||
import { useMobile } from "@follow/components/hooks/useMobile.js"
|
||||
import { Tooltip, TooltipContent, TooltipTrigger } from "@follow/components/ui/tooltip/index.jsx"
|
||||
@@ -23,7 +22,6 @@ import {
|
||||
useAudioPlayerAtomSelector,
|
||||
useAudioPlayerAtomValue,
|
||||
} from "~/atoms/player"
|
||||
import { FocusablePresets } from "~/components/common/Focusable"
|
||||
import { VolumeSlider } from "~/components/ui/media/VolumeSlider"
|
||||
import type { NavigateEntryOptions } from "~/hooks/biz/useNavigateEntry"
|
||||
import { useNavigateEntry } from "~/hooks/biz/useNavigateEntry"
|
||||
@@ -31,7 +29,6 @@ import type { FeedIconEntry } from "~/modules/feed/feed-icon"
|
||||
import { FeedIcon } from "~/modules/feed/feed-icon"
|
||||
|
||||
import { COMMAND_ID } from "../command/commands/id"
|
||||
import { useCommandBinding } from "../command/hooks/use-command-binding"
|
||||
|
||||
const handleClickPlay = () => {
|
||||
AudioPlayer.togglePlayAndPause()
|
||||
@@ -141,11 +138,6 @@ const CornerPlayerImpl = ({ hideControls, rounded }: ControlButtonProps) => {
|
||||
const subscription = useSubscriptionByFeedId(entry?.feedId)
|
||||
const list = useListById(listId)
|
||||
|
||||
useCommandBinding({
|
||||
commandId: COMMAND_ID.global.toggleCornerPlay,
|
||||
when: useGlobalFocusableScopeSelector(FocusablePresets.isSubscriptionOrTimeline),
|
||||
})
|
||||
|
||||
useEffect(() => {
|
||||
return EventBus.subscribe(COMMAND_ID.global.toggleCornerPlay, () => {
|
||||
handleClickPlay()
|
||||
|
||||
-15
@@ -7,12 +7,10 @@ import { cn } from "@follow/utils/utils"
|
||||
import { m } from "motion/react"
|
||||
import type { FC, PropsWithChildren } from "react"
|
||||
import { memo, useEffect, useRef, useState } from "react"
|
||||
import { useHotkeys } from "react-hotkeys-hook"
|
||||
import { useTranslation } from "react-i18next"
|
||||
import { Link } from "react-router"
|
||||
import { toast } from "sonner"
|
||||
|
||||
import { setAppSearchOpen } from "~/atoms/app"
|
||||
import { useIsZenMode, useSetZenMode } from "~/atoms/settings/ui"
|
||||
import { setTimelineColumnShow, useTimelineColumnShow } from "~/atoms/sidebar"
|
||||
import {
|
||||
@@ -61,7 +59,6 @@ export const SubscriptionColumnHeader = memo(() => {
|
||||
<i className="i-mgc-add-cute-re text-text-secondary size-5" />
|
||||
</ActionButton>
|
||||
</Link>
|
||||
<SearchTrigger />
|
||||
|
||||
<ProfileButton method="modal" animatedAvatar />
|
||||
<LayoutActionButton />
|
||||
@@ -155,15 +152,3 @@ const LogoContextMenu: FC<PropsWithChildren> = ({ children }) => {
|
||||
</DropdownMenu>
|
||||
)
|
||||
}
|
||||
|
||||
const SearchTrigger = () => {
|
||||
useHotkeys(
|
||||
"meta+k,ctrl+k",
|
||||
() => {
|
||||
setAppSearchOpen(true)
|
||||
},
|
||||
{ preventDefault: true },
|
||||
)
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
@@ -15,11 +15,37 @@ import { COMMAND_ID } from "~/modules/command/commands/id"
|
||||
import { useRunCommandFn } from "~/modules/command/hooks/use-command"
|
||||
import { useCommandBinding, useCommandShortcuts } from "~/modules/command/hooks/use-command-binding"
|
||||
|
||||
export const GlobalHotkeysProvider = () => {
|
||||
const useRegisterGlobalHotkeys = () => {
|
||||
const notInFloatingLayerScope = useGlobalFocusableScopeSelector(
|
||||
FocusablePresets.isNotFloatingLayerScope,
|
||||
)
|
||||
useCommandBinding({
|
||||
commandId: COMMAND_ID.global.showShortcuts,
|
||||
when: notInFloatingLayerScope,
|
||||
})
|
||||
|
||||
useCommandBinding({
|
||||
commandId: COMMAND_ID.global.toggleCornerPlay,
|
||||
when: notInFloatingLayerScope,
|
||||
})
|
||||
|
||||
useCommandBinding({
|
||||
commandId: COMMAND_ID.global.quickAdd,
|
||||
when: notInFloatingLayerScope,
|
||||
})
|
||||
|
||||
useCommandBinding({
|
||||
commandId: COMMAND_ID.global.quickSearch,
|
||||
when: notInFloatingLayerScope,
|
||||
})
|
||||
|
||||
useCommandBinding({
|
||||
commandId: COMMAND_ID.global.toggleAIChat,
|
||||
when: notInFloatingLayerScope,
|
||||
})
|
||||
}
|
||||
export const GlobalHotkeysProvider = () => {
|
||||
useRegisterGlobalHotkeys()
|
||||
useEventListener("keydown", (e) => {
|
||||
if (e.key === "Tab") {
|
||||
nextFrame(() => {
|
||||
|
||||
@@ -18,6 +18,8 @@
|
||||
"command.entry.scroll_up.title": "Scroll Up",
|
||||
"command.global.quick_add.description": "Open quick add panel to follow a new feed or others",
|
||||
"command.global.quick_add.title": "Quick Add",
|
||||
"command.global.quick_search.description": "Open the quick search panel",
|
||||
"command.global.quick_search.title": "Quick Search",
|
||||
"command.global.show_shortcuts.description": "Show the shortcuts guideline modal",
|
||||
"command.global.show_shortcuts.title": "Show Shortcuts",
|
||||
"command.global.toggle_ai_chat.description": "Toggle the AI chat panel",
|
||||
|
||||
Generated
+9
-9
@@ -774,8 +774,8 @@ importers:
|
||||
specifier: workspace:*
|
||||
version: link:../../../../packages/internal/utils
|
||||
'@folo-services/ai-tools':
|
||||
specifier: 0.2.34
|
||||
version: 0.2.34(@opentelemetry/api@1.9.0)(@types/pg@8.6.1)(expo-sqlite@15.2.12(expo@53.0.12(@babel/core@7.28.0)(@expo/metro-runtime@5.0.4(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0)))(bufferutil@4.0.9)(graphql@16.8.1)(react-native-webview@13.15.0(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(kysely@0.28.2)(pg@8.16.3)
|
||||
specifier: 0.2.36
|
||||
version: 0.2.36(@opentelemetry/api@1.9.0)(@types/pg@8.6.1)(expo-sqlite@15.2.12(expo@53.0.12(@babel/core@7.28.0)(@expo/metro-runtime@5.0.4(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0)))(bufferutil@4.0.9)(graphql@16.8.1)(react-native-webview@13.15.0(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(kysely@0.28.2)(pg@8.16.3)
|
||||
'@types/node':
|
||||
specifier: 24.0.10
|
||||
version: 24.0.10
|
||||
@@ -4060,8 +4060,8 @@ packages:
|
||||
'@follow-app/client-sdk@0.3.50':
|
||||
resolution: {integrity: sha512-qc8gI5li/v62h1oR8p0bkLh+tlNaEP8jogppoP92v10XktERtd0rrx5grvSQ1pw0mM3Fws4CknEJZeGH9leDaw==}
|
||||
|
||||
'@folo-services/ai-tools@0.2.34':
|
||||
resolution: {integrity: sha512-c1RwRccJCWIBzkPrzVkfOMk6DrB1Ftfa3IHXgrRFx4qQWNGKDeeEG5W6zcFHUam4mUncsydzUBZeiQUBTXJCEA==}
|
||||
'@folo-services/ai-tools@0.2.36':
|
||||
resolution: {integrity: sha512-MNgXELZklcwteBjyC92lp2xgVm1ydDRkX+5dl4ZiYYqVi9spbD3GcckurbiQJ9ANF/7PW71nnJSIo7/9y8qaWg==}
|
||||
|
||||
'@folo-services/constants@0.1.29':
|
||||
resolution: {integrity: sha512-7YH5UQyUoT0STsoAKXTJgdAlvW88RKe5L/yqq4nbovSf2UJm1yEfl+opOYMeYEKBzX3OnixIipPL/1oKQPeh0w==}
|
||||
@@ -4069,8 +4069,8 @@ packages:
|
||||
'@folo-services/drizzle@0.1.23':
|
||||
resolution: {integrity: sha512-Y4oGzfcYtsh9jdaDZvMh0CMO2tD1c2VSt1gtaZbq9uF17sv45empMI72OdGfWEJBJse7h/P+YGydX7iK63aoIQ==}
|
||||
|
||||
'@folo-services/drizzle@0.1.24':
|
||||
resolution: {integrity: sha512-C2B32AuAIoPihwkowEzQVSCq9jz5gUJOXWSTsh46ICCXIQ+FeDLclGuOS13+3FQ79mGBslUqrRu5chpoeDLE/g==}
|
||||
'@folo-services/drizzle@0.1.25':
|
||||
resolution: {integrity: sha512-FByV3IWHAV3qh5G9eIl6dUzUGfWakk+VyjOBBseVQ5InpZiCZyMAKh5MXsvR1L4Uew/cX+rHey6dNfo80BYB7Q==}
|
||||
|
||||
'@folo-services/exceptions@0.1.16':
|
||||
resolution: {integrity: sha512-ThmLLe1Dv2CFsDIgcuY6kJhYJnjiQ7UEsewaqc25MkuImDabhzWnnad+3zRnJGLpveaMeEZ69uqUsTbKC+fR7g==}
|
||||
@@ -19018,10 +19018,10 @@ snapshots:
|
||||
- sql.js
|
||||
- sqlite3
|
||||
|
||||
'@folo-services/ai-tools@0.2.34(@opentelemetry/api@1.9.0)(@types/pg@8.6.1)(expo-sqlite@15.2.12(expo@53.0.12(@babel/core@7.28.0)(@expo/metro-runtime@5.0.4(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0)))(bufferutil@4.0.9)(graphql@16.8.1)(react-native-webview@13.15.0(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(kysely@0.28.2)(pg@8.16.3)':
|
||||
'@folo-services/ai-tools@0.2.36(@opentelemetry/api@1.9.0)(@types/pg@8.6.1)(expo-sqlite@15.2.12(expo@53.0.12(@babel/core@7.28.0)(@expo/metro-runtime@5.0.4(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0)))(bufferutil@4.0.9)(graphql@16.8.1)(react-native-webview@13.15.0(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(kysely@0.28.2)(pg@8.16.3)':
|
||||
dependencies:
|
||||
'@ai-sdk/openai': 2.0.22(zod@3.25.76)
|
||||
'@folo-services/drizzle': 0.1.24(@opentelemetry/api@1.9.0)(@types/pg@8.6.1)(expo-sqlite@15.2.12(expo@53.0.12(@babel/core@7.28.0)(@expo/metro-runtime@5.0.4(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0)))(bufferutil@4.0.9)(graphql@16.8.1)(react-native-webview@13.15.0(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(kysely@0.28.2)
|
||||
'@folo-services/drizzle': 0.1.25(@opentelemetry/api@1.9.0)(@types/pg@8.6.1)(expo-sqlite@15.2.12(expo@53.0.12(@babel/core@7.28.0)(@expo/metro-runtime@5.0.4(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0)))(bufferutil@4.0.9)(graphql@16.8.1)(react-native-webview@13.15.0(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(kysely@0.28.2)
|
||||
ai: 5.0.26(zod@3.25.76)
|
||||
drizzle-orm: 0.44.3(@opentelemetry/api@1.9.0)(@types/pg@8.6.1)(expo-sqlite@15.2.12(expo@53.0.12(@babel/core@7.28.0)(@expo/metro-runtime@5.0.4(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0)))(bufferutil@4.0.9)(graphql@16.8.1)(react-native-webview@13.15.0(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(kysely@0.28.2)(pg@8.16.3)
|
||||
zod: 3.25.76
|
||||
@@ -19100,7 +19100,7 @@ snapshots:
|
||||
- sql.js
|
||||
- sqlite3
|
||||
|
||||
'@folo-services/drizzle@0.1.24(@opentelemetry/api@1.9.0)(@types/pg@8.6.1)(expo-sqlite@15.2.12(expo@53.0.12(@babel/core@7.28.0)(@expo/metro-runtime@5.0.4(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0)))(bufferutil@4.0.9)(graphql@16.8.1)(react-native-webview@13.15.0(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(kysely@0.28.2)':
|
||||
'@folo-services/drizzle@0.1.25(@opentelemetry/api@1.9.0)(@types/pg@8.6.1)(expo-sqlite@15.2.12(expo@53.0.12(@babel/core@7.28.0)(@expo/metro-runtime@5.0.4(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0)))(bufferutil@4.0.9)(graphql@16.8.1)(react-native-webview@13.15.0(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(kysely@0.28.2)':
|
||||
dependencies:
|
||||
'@folo-services/exceptions': 0.1.16
|
||||
drizzle-orm: 0.44.3(@opentelemetry/api@1.9.0)(@types/pg@8.6.1)(expo-sqlite@15.2.12(expo@53.0.12(@babel/core@7.28.0)(@expo/metro-runtime@5.0.4(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0)))(bufferutil@4.0.9)(graphql@16.8.1)(react-native-webview@13.15.0(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(react-native@0.79.1(@babel/core@7.28.0)(@types/react@19.1.8)(bufferutil@4.0.9)(react@19.0.0))(react@19.0.0))(kysely@0.28.2)(pg@8.16.3)
|
||||
|
||||
Reference in New Issue
Block a user