Merge remote-tracking branch 'origin/main'

This commit is contained in:
DIYgod
2024-05-25 11:55:53 +08:00
48 changed files with 383 additions and 246 deletions
+2 -2
View File
@@ -1,4 +1,4 @@
import { app, shell, BrowserWindow } from "electron"
import { shell, BrowserWindow } from "electron"
import path from "path"
import { is } from "@electron-toolkit/utils"
import icon from "../../resources/icon.png?asset"
@@ -61,7 +61,7 @@ export function createWindow(options?: {
trueUrl = decodeURIComponent(
details.url.replace(
new RegExp(
`^${process.env["VITE_IMGPROXY_URL"]}/unsafe/\\d+x\\d+\/`,
`^${process.env["VITE_IMGPROXY_URL"]}/unsafe/\\d+x\\d+/`,
),
"",
),
+1 -1
View File
@@ -4,7 +4,7 @@ function App() {
return (
<>
<div
className="h-10 drag-region shrink-0 absolute top-0 inset-x-0"
className="drag-region absolute inset-x-0 top-0 h-10 shrink-0"
aria-hidden
></div>
<Outlet />
@@ -5,10 +5,10 @@ import { FeedIcon } from "@renderer/components/feed-icon"
export function ArticleItem({ entry }: { entry: EntriesResponse[number] }) {
return (
<div className="flex my-5 px-2 py-3">
<div className="my-5 flex px-2 py-3">
<FeedIcon feed={entry.feeds} />
<div className="line-clamp-5 text-sm flex-1 -mt-0.5 leading-tight">
<div className="text-zinc-500 text-[10px] space-x-1">
<div className="-mt-0.5 line-clamp-5 flex-1 text-sm leading-tight">
<div className="space-x-1 text-[10px] text-zinc-500">
<span>{entry.feeds.title}</span>
<span>·</span>
<span>
@@ -20,13 +20,13 @@ export function ArticleItem({ entry }: { entry: EntriesResponse[number] }) {
.humanize()}
</span>
</div>
<div className="font-medium my-0.5 break-words">{entry.title}</div>
<div className="text-zinc-500 text-[13px]">{entry.description}</div>
<div className="my-0.5 break-words font-medium">{entry.title}</div>
<div className="text-[13px] text-zinc-500">{entry.description}</div>
</div>
{entry.images?.[0] && (
<Image
src={entry.images[0]}
className="w-20 h-20 shrink-0 ml-2"
className="ml-2 size-20 shrink-0"
loading="lazy"
proxy={{
width: 160,
@@ -43,8 +43,8 @@ export function EntryColumn() {
return (
<div className="px-2" onClick={() => setActiveEntry(null)}>
<div className="ml-9 mb-5">
<div className="font-bold text-lg">{activeList?.name}</div>
<div className="mb-5 ml-9">
<div className="text-lg font-bold">{activeList?.name}</div>
<div className="text-xs font-medium text-zinc-400">
{entries.data?.pages?.[0].total} Items
</div>
@@ -59,7 +59,7 @@ export function EntryColumn() {
className={cn(
activeList?.view &&
gridMode.includes(activeList.view) &&
"grid gap-2 grid-cols-2 md:grid-cols-3 lg:grid-cols-4 px-2",
"grid grid-cols-2 gap-2 px-2 md:grid-cols-3 lg:grid-cols-4",
)}
>
{page.data?.map((entry) => (
@@ -13,14 +13,13 @@ export function EntryItemWrapper({
children: React.ReactNode
view?: number
}) {
if (!entry?.url || view === undefined) return children
const { items } = useEntryActions({
view,
entry,
})
const { activeEntry, setActiveEntry } = useMainLayoutContext()
if (!entry?.url || view === undefined) return children
return (
<div
@@ -8,10 +8,10 @@ export function NotificationItem({
entry: EntriesResponse[number]
}) {
return (
<div className="flex my-5 px-2 py-3">
<div className="my-5 flex px-2 py-3">
<FeedIcon feed={entry.feeds} />
<div className="line-clamp-5 text-sm flex-1 -mt-0.5 leading-tight">
<div className="text-zinc-500 text-[10px] space-x-1">
<div className="-mt-0.5 line-clamp-5 flex-1 text-sm leading-tight">
<div className="space-x-1 text-[10px] text-zinc-500">
<span>{entry.feeds.title}</span>
<span>·</span>
<span>
@@ -12,7 +12,7 @@ export function PictureItem({ entry }: { entry: EntriesResponse[number] }) {
<Image
key={image}
src={image}
className="w-full aspect-square shrink-0 rounded-md object-cover"
className="aspect-square w-full shrink-0 rounded-md object-cover"
loading="lazy"
proxy={{
width: 600,
@@ -21,11 +21,11 @@ export function PictureItem({ entry }: { entry: EntriesResponse[number] }) {
/>
))}
</div>
<div className="line-clamp-5 text-sm flex-1 px-2 pb-3 pt-1">
<div className="font-medium line-clamp-2">{entry.title}</div>
<div className="line-clamp-5 flex-1 px-2 pb-3 pt-1 text-sm">
<div className="line-clamp-2 font-medium">{entry.title}</div>
<div className="space-x-1 text-[13px]">
<FeedIcon
className="w-3.5 h-3.5 inline-block mr-0 align-sub"
className="mr-0 inline-block size-3.5 align-sub"
feed={entry.feeds}
/>
<span>{entry.feeds.title}</span>
@@ -5,10 +5,10 @@ import { FeedIcon } from "@renderer/components/feed-icon"
export function SocialMediaItem({ entry }: { entry: EntriesResponse[number] }) {
return (
<div className="flex my-5 px-2 py-3">
<div className="my-5 flex px-2 py-3">
<FeedIcon feed={entry.feeds} />
<div>
<div className="line-clamp-5 text-sm flex-1 -mt-0.5">
<div className="-mt-0.5 line-clamp-5 flex-1 text-sm">
<div className="space-x-1">
<span className="font-medium">{entry.author}</span>
<span className="text-zinc-500">·</span>
@@ -23,12 +23,12 @@ export function SocialMediaItem({ entry }: { entry: EntriesResponse[number] }) {
</div>
<div className="mt-0.5">{entry.description}</div>
</div>
<div className="flex gap-2 overflow-x-auto mt-1">
<div className="mt-1 flex gap-2 overflow-x-auto">
{entry.images?.map((image) => (
<Image
key={image}
src={image}
className="w-28 h-28 shrink-0"
className="size-28 shrink-0"
loading="lazy"
proxy={{
width: 224,
@@ -11,7 +11,7 @@ export function VideoItem({ entry }: { entry: EntriesResponse[number] }) {
<Image
key={entry.images?.[0]}
src={entry.images?.[0]}
className="w-full aspect-video shrink-0 rounded-md object-cover"
className="aspect-video w-full shrink-0 rounded-md object-cover"
loading="lazy"
proxy={{
width: 640,
@@ -19,11 +19,11 @@ export function VideoItem({ entry }: { entry: EntriesResponse[number] }) {
}}
/>
</div>
<div className="line-clamp-5 text-sm flex-1 px-2 pb-3 pt-1">
<div className="font-medium line-clamp-2">{entry.title}</div>
<div className="line-clamp-5 flex-1 px-2 pb-3 pt-1 text-sm">
<div className="line-clamp-2 font-medium">{entry.title}</div>
<div className="space-x-1 text-[13px]">
<FeedIcon
className="w-3.5 h-3.5 inline-block mr-0 align-sub"
className="mr-0 inline-block size-3.5 align-sub"
feed={entry.feeds}
/>
<span>{entry.author}</span>
@@ -26,7 +26,7 @@ export function EntryContent({ entryId }: { entryId: ActiveEntry }) {
<>
<EntryShare entry={entry.data} view={0} />
<m.div
className="px-5 py-5 overflow-y-auto h-[calc(100%-3.5rem)]"
className="h-[calc(100%-3.5rem)] overflow-y-auto p-5"
initial={{ opacity: 0.01, y: 100 }}
animate={{ opacity: 1, y: 0 }}
exit={{ opacity: 0.01, y: -100 }}
@@ -36,12 +36,13 @@ export function EntryContent({ entryId }: { entryId: ActiveEntry }) {
<a
href={entry.data?.url}
target="_blank"
className="block hover:bg-zinc-100 max-w-[598px] mx-auto p-6 rounded-md transition-colors"
className="mx-auto block max-w-[598px] rounded-md p-6 transition-colors hover:bg-zinc-100"
rel="noreferrer"
>
<div className="text-3xl font-bold select-text break-words">
<div className="select-text break-words text-3xl font-bold">
{entry.data?.title}
</div>
<div className="mt-2 text-[13px] text-zinc-500 font-medium">
<div className="mt-2 text-[13px] font-medium text-zinc-500">
{entry.data?.feeds?.title}
</div>
<div className="text-[13px] text-zinc-500">
@@ -49,7 +50,7 @@ export function EntryContent({ entryId }: { entryId: ActiveEntry }) {
new Date(entry.data?.publishedAt).toUTCString()}
</div>
</a>
<div className="max-w-[550px] mx-auto mt-10 mb-32 prose text-[15px] prose-zinc select-text cursor-auto">
<div className="prose prose-zinc mx-auto mb-32 mt-10 max-w-[550px] cursor-auto select-text text-[15px]">
{content}
</div>
</div>
@@ -15,15 +15,14 @@ export function EntryShare({
view: number
entry?: EntriesResponse[number]
}) {
if (!entry?.url) return null
const { items } = useEntryActions({
view,
entry,
})
if (!entry?.url) return null
return (
<div className="px-5 h-14 flex items-center text-lg justify-end text-zinc-500 gap-3">
<div className="flex h-14 items-center justify-end gap-3 px-5 text-lg text-zinc-500">
<TooltipProvider>
{items
.filter((item) => !item.disabled)
@@ -31,13 +30,13 @@ export function EntryShare({
<Tooltip key={item.name}>
<TooltipTrigger asChild>
<Button
className="flex items-center text-xl no-drag-region"
className="no-drag-region flex items-center text-xl"
variant="ghost"
size="sm"
onClick={item.onClick}
>
{item.icon ? (
<img className="w-4 h-4 grayscale" src={item.icon} />
<img className="size-4 grayscale" src={item.icon} />
) : (
<i className={item.className} />
)}
@@ -6,9 +6,7 @@ import {
FormControl,
FormField,
FormItem,
FormLabel,
FormMessage,
FormDescription,
} from "@renderer/components/ui/form"
import { useMutation, useQueryClient } from "@tanstack/react-query"
import {
@@ -74,7 +74,7 @@ export function FeedCategory({
<Dialog open={dialogOpen} onOpenChange={setDialogOpen}>
<div
className={cn(
"flex items-center justify-between font-medium text-sm leading-loose px-2.5 py-[2px] rounded-md w-full transition-colors",
"flex w-full items-center justify-between rounded-md px-2.5 py-[2px] text-sm font-medium leading-loose transition-colors",
activeList?.level === levels.folder &&
activeList.name === data.name &&
"bg-native-active",
@@ -113,10 +113,10 @@ export function FeedCategory({
)
}}
>
<div className="flex items-center min-w-0 w-full">
<div className="flex w-full min-w-0 items-center">
<CollapsibleTrigger
className={cn(
"flex items-center h-7 [&_.i-mingcute-right-fill]:data-[state=open]:rotate-90",
"flex h-7 items-center [&_.i-mingcute-right-fill]:data-[state=open]:rotate-90",
!setActiveList && "flex-1",
)}
>
@@ -128,7 +128,7 @@ export function FeedCategory({
{setActiveList && <span className="truncate">{data.name}</span>}
</div>
{!!data.unread && (
<div className="text-xs text-zinc-500 ml-2">{data.unread}</div>
<div className="ml-2 text-xs text-zinc-500">{data.unread}</div>
)}
<CategoryRenameDialog
feedIdList={feedIdList}
@@ -163,7 +163,7 @@ export function FeedCategory({
key={feed.feedId}
feed={feed}
view={view}
className={!!data.name ? "pl-6" : "pl-2.5"}
className={data.name ? "pl-6" : "pl-2.5"}
/>
))}
</m.div>
@@ -57,7 +57,7 @@ export function FeedColumn() {
return (
<div
className="h-full flex flex-col gap-3"
className="flex h-full flex-col gap-3"
onClick={() =>
setActiveList?.({
level: levels.view,
@@ -70,7 +70,7 @@ export function FeedColumn() {
>
<div className="ml-5 mr-3 flex items-center justify-between">
<div
className="font-bold text-xl flex items-center gap-1"
className="flex items-center gap-1 text-xl font-bold"
onClick={(e) => {
e.stopPropagation()
setActiveList?.({
@@ -92,12 +92,12 @@ export function FeedColumn() {
</Button>
<Button variant="ghost" size="sm">
<Link to={`/follow`} className="flex">
<i className="i-mingcute-add-line h-5 w-5 text-zinc-500" />
<i className="i-mingcute-add-line size-5 text-zinc-500" />
</Link>
</Button>
</div>
</div>
<div className="flex text-zinc-500 w-full justify-between text-xl px-3">
<div className="flex w-full justify-between px-3 text-xl text-zinc-500">
<TooltipProvider>
{views.map((item, index) => (
<Tooltip key={item.name}>
@@ -128,14 +128,14 @@ export function FeedColumn() {
))}
</TooltipProvider>
</div>
<div className="w-full h-full overflow-clip" ref={carouselRef}>
<m.div className="h-full flex" style={{ x: spring }}>
<div className="size-full overflow-hidden" ref={carouselRef}>
<m.div className="flex h-full" style={{ x: spring }}>
{views.map((item, index) => (
<section
key={item.name}
className="snap-center shrink-0 overflow-y-auto"
className="shrink-0 snap-center overflow-y-auto"
>
<FeedList className="w-64 px-3 mb-6" view={index} />
<FeedList className="mb-6 w-64 px-3" view={index} />
</section>
))}
</m.div>
@@ -60,7 +60,7 @@ export function FeedItem({
duration: 3000,
description: (
<>
Feed <i className="font-semibold mr-px">{variables.feeds.title}</i>{" "}
Feed <i className="mr-px font-semibold">{variables.feeds.title}</i>{" "}
has been unfollowed.
</>
),
@@ -93,7 +93,7 @@ export function FeedItem({
<Dialog key={feed.feedId} open={dialogOpen} onOpenChange={setDialogOpen}>
<div
className={cn(
"flex items-center justify-between text-sm font-medium leading-loose w-full pr-2.5 py-[2px] rounded-md",
"flex w-full items-center justify-between rounded-md py-[2px] pr-2.5 text-sm font-medium leading-loose",
activeList?.level === levels.feed &&
activeList.id === feed.feedId &&
"bg-native-active",
@@ -146,17 +146,17 @@ export function FeedItem({
>
<div
className={cn(
"flex items-center min-w-0",
"flex min-w-0 items-center",
feed.feeds.errorAt && "text-red-900",
)}
>
<FeedIcon feed={feed.feeds} className="w-4 h-4" />
<FeedIcon feed={feed.feeds} className="size-4" />
<div className="truncate">{feed.feeds.title}</div>
{feed.feeds.errorAt && (
<TooltipProvider delayDuration={300}>
<Tooltip>
<TooltipTrigger asChild>
<i className="i-mingcute-wifi-off-line shrink-0 ml-1 text-base" />
<i className="i-mingcute-wifi-off-line ml-1 shrink-0 text-base" />
</TooltipTrigger>
<TooltipPortal>
<TooltipContent>
@@ -176,7 +176,7 @@ export function FeedItem({
<TooltipProvider delayDuration={300}>
<Tooltip>
<TooltipTrigger asChild>
<i className="i-mingcute-eye-close-line shrink-0 ml-1 text-base" />
<i className="i-mingcute-eye-close-line ml-1 shrink-0 text-base" />
</TooltipTrigger>
<TooltipPortal>
<TooltipContent>
@@ -188,7 +188,7 @@ export function FeedItem({
)}
</div>
{!!feed.unread && (
<div className="text-xs text-zinc-500 ml-2">{feed.unread}</div>
<div className="ml-2 text-xs text-zinc-500">{feed.unread}</div>
)}
<FollowDialog
feed={feed}
@@ -22,7 +22,7 @@ export function FeedList({
<div className={className}>
{!hideTitle && (
<div
className={cn("flex items-center justify-between mb-2 px-2.5 py-1")}
className={cn("mb-2 flex items-center justify-between px-2.5 py-1")}
>
<div
className="font-bold"
@@ -39,7 +39,7 @@ export function FeedList({
>
{view !== undefined && views[view].name}
</div>
<div className="text-sm text-zinc-500 ml-2 flex items-center gap-3">
<div className="ml-2 flex items-center gap-3 text-sm text-zinc-500">
{expansion ? (
<i
className="i-mingcute-list-collapse-fill"
+1 -1
View File
@@ -16,7 +16,7 @@ export function FeedIcon({
return (
<Image
src={feed.image}
className={cn("w-5 h-5 mr-2 rounded-sm shrink-0", className)}
className={cn("mr-2 size-5 shrink-0 rounded-sm", className)}
proxy={{
width: 40,
height: 40,
+11 -6
View File
@@ -9,21 +9,26 @@ export function FollowSummary({
docs?: string
}) {
return (
<div className="select-text text-sm space-y-1 max-w-[462px]">
<a href={feed.siteUrl} target="_blank" className="flex items-center">
<div className="max-w-[462px] select-text space-y-1 text-sm">
<a
href={feed.siteUrl}
target="_blank"
className="flex items-center"
rel="noreferrer"
>
<FeedIcon
feed={feed}
fallbackUrl={docs}
className="w-8 h-8 mr-2 shrink-0"
className="mr-2 size-8 shrink-0"
/>
<div className="leading-tight font-semibold text-base truncate">
<div className="truncate text-base font-semibold leading-tight">
{feed.title}
<div className="font-normal truncate text-xs text-zinc-500">
<div className="truncate text-xs font-normal text-zinc-500">
{feed.description}
</div>
</div>
</a>
<div className="text-zinc-500 flex items-center gap-1 truncate">
<div className="flex items-center gap-1 truncate text-zinc-500">
<i className="i-mingcute-right-line shrink-0" />
{feed.url || docs}
</div>
+8 -7
View File
@@ -100,7 +100,7 @@ export function FollowForm({ type }: { type: string }) {
<Form {...form}>
<form
onSubmit={form.handleSubmit(onSubmit)}
className="space-y-8 w-[512px]"
className="w-[512px] space-y-8"
>
<FormField
control={form.control}
@@ -121,8 +121,8 @@ export function FollowForm({ type }: { type: string }) {
</form>
</Form>
{mutation.isSuccess && (
<div className="max-w-lg mt-8">
<div className="text-zinc-500 mb-4">
<div className="mt-8 max-w-lg">
<div className="mb-4 text-zinc-500">
Found {mutation.data?.length || 0} feed
{mutation.data?.length > 1 && "s"}
</div>
@@ -134,7 +134,7 @@ export function FollowForm({ type }: { type: string }) {
</CardHeader>
{item.docs ? (
<CardFooter>
<a href={item.docs} target="_blank">
<a href={item.docs} target="_blank" rel="noreferrer">
<Button>View Docs</Button>
</a>
</CardFooter>
@@ -150,7 +150,8 @@ export function FollowForm({ type }: { type: string }) {
key={entry.id}
href={entry.url}
target="_blank"
className="flex items-center gap-1 flex-col min-w-0 flex-1"
className="flex min-w-0 flex-1 flex-col items-center gap-1"
rel="noreferrer"
>
{entry.images?.[0] ? (
<Image
@@ -158,7 +159,7 @@ export function FollowForm({ type }: { type: string }) {
className="aspect-square w-full"
/>
) : (
<div className="bg-stone-100 rounded text-zinc-500 p-2 overflow-hidden w-full aspect-square text-xs leading-tight flex">
<div className="flex aspect-square w-full overflow-hidden rounded bg-stone-100 p-2 text-xs leading-tight text-zinc-500">
{entry.title}
</div>
)}
@@ -179,7 +180,7 @@ export function FollowForm({ type }: { type: string }) {
<FollowButton feed={item.feed} />
)}
<div className="ml-6 text-zinc-500">
<span className="text-zinc-800 font-medium">
<span className="font-medium text-zinc-800">
{item.subscriptionCount}
</span>{" "}
Followers
@@ -16,6 +16,7 @@ import { Card, CardContent, CardHeader } from "@renderer/components/ui/card"
import { FollowSummary } from "../feed-summary"
import { apiFetch } from "@renderer/lib/queries/api-fetch"
import { cn } from "@renderer/lib/utils"
import type { FeedResponse } from "@renderer/lib/types"
type FeedResponseList = {
id: string
@@ -85,7 +86,7 @@ export function FollowImport() {
<Form {...form}>
<form
onSubmit={form.handleSubmit(onSubmit)}
className="space-y-8 w-[512px]"
className="w-[512px] space-y-8"
>
<FormField
control={form.control}
@@ -114,9 +115,9 @@ export function FollowImport() {
</form>
</Form>
{mutation.isSuccess && (
<div className="max-w-lg mt-8">
<div className="mt-8 max-w-lg">
<Card>
<CardHeader className="text-zinc-500 block">
<CardHeader className="block text-zinc-500">
<span className="font-bold text-zinc-800">
{mutation.data?.successfulItems.length || 0}
</span>{" "}
@@ -134,7 +135,7 @@ export function FollowImport() {
{list.map((item) => (
<div key={item.key}>
<div
className={cn("font-medium text-lg mb-4", item.className)}
className={cn("mb-4 text-lg font-medium", item.className)}
>
{item.title}
</div>
@@ -142,8 +143,8 @@ export function FollowImport() {
{!mutation.data?.[item.key].length && (
<div className="text-zinc-500">No items</div>
)}
{mutation.data?.[item.key].map((feed) => (
<FollowSummary feed={feed} />
{mutation.data?.[item.key].map((feed: FeedResponse) => (
<FollowSummary key={feed.id} feed={feed} />
))}
</div>
</div>
@@ -1,7 +1,7 @@
export function Recommendations({ type }: { type: string }) {
return (
<div className="mt-8">
<div className="font-medium text-lg">Suggested</div>
<div className="text-lg font-medium">Suggested</div>
<ul className="mt-2">
<li>Suggestions1</li>
<li>Suggestions2</li>
+1 -1
View File
@@ -27,7 +27,7 @@ export function SiteIcon({
return (
<img
src={src}
className={cn("w-5 h-5 mr-2 rounded-sm shrink-0", className)}
className={cn("mr-2 size-5 shrink-0 rounded-sm", className)}
loading="lazy"
onError={(e) => {
if (fallback) {
@@ -41,7 +41,7 @@ export const AutoComplete = React.forwardRef<HTMLInputElement, InputProps>(
)
return (
<Command className="rounded-lg border overflow-visible relative [&_[cmdk-input-wrapper]]:border-0 [&_.lucide-search]:hidden">
<Command className="relative overflow-visible rounded-lg border [&_.lucide-search]:hidden [&_[cmdk-input-wrapper]]:border-0">
<CommandInput
{...props}
onBlur={(e) => {
@@ -62,7 +62,7 @@ export const AutoComplete = React.forwardRef<HTMLInputElement, InputProps>(
<CommandList>
<CommandGroup
className={cn(
"absolute top-full bg-white w-full z-10 border rounded-lg mt-1 hidden [&[hidden]]:!hidden",
"absolute top-full z-10 mt-1 hidden w-full rounded-lg border bg-white [&[hidden]]:!hidden",
open && "block",
)}
>
@@ -86,3 +86,4 @@ export const AutoComplete = React.forwardRef<HTMLInputElement, InputProps>(
)
},
)
AutoComplete.displayName = "AutoComplete"
+3 -3
View File
@@ -10,7 +10,7 @@ const Avatar = React.forwardRef<
<AvatarPrimitive.Root
ref={ref}
className={cn(
"relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",
"relative flex size-10 shrink-0 overflow-hidden rounded-full",
className,
)}
{...props}
@@ -24,7 +24,7 @@ const AvatarImage = React.forwardRef<
>(({ className, ...props }, ref) => (
<AvatarPrimitive.Image
ref={ref}
className={cn("aspect-square h-full w-full", className)}
className={cn("aspect-square size-full", className)}
{...props}
/>
))
@@ -37,7 +37,7 @@ const AvatarFallback = React.forwardRef<
<AvatarPrimitive.Fallback
ref={ref}
className={cn(
"flex h-full w-full items-center justify-center rounded-full bg-muted",
"flex size-full items-center justify-center rounded-full bg-muted",
className,
)}
{...props}
+1 -1
View File
@@ -57,7 +57,7 @@ const Button = React.forwardRef<HTMLButtonElement, ButtonProps>(
{...props}
>
{isLoading && (
<i className="animate-spin i-mingcute-loading-3-line mr-2" />
<i className="i-mingcute-loading-3-line mr-2 animate-spin" />
)}
{props.children}
</Comp>
+2 -2
View File
@@ -11,7 +11,7 @@ const Checkbox = React.forwardRef<
<CheckboxPrimitive.Root
ref={ref}
className={cn(
"peer h-4 w-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
"peer size-4 shrink-0 rounded-sm border border-primary ring-offset-background focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=checked]:text-primary-foreground",
className,
)}
{...props}
@@ -19,7 +19,7 @@ const Checkbox = React.forwardRef<
<CheckboxPrimitive.Indicator
className={cn("flex items-center justify-center text-current")}
>
<Check className="h-4 w-4" />
<Check className="size-4" />
</CheckboxPrimitive.Indicator>
</CheckboxPrimitive.Root>
))
+4 -3
View File
@@ -13,7 +13,7 @@ const Command = React.forwardRef<
<CommandPrimitive
ref={ref}
className={cn(
"flex h-full w-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
"flex size-full flex-col overflow-hidden rounded-md bg-popover text-popover-foreground",
className,
)}
{...props}
@@ -27,7 +27,7 @@ const CommandDialog = ({ children, ...props }: CommandDialogProps) => {
return (
<Dialog {...props}>
<DialogContent className="overflow-hidden p-0 shadow-lg">
<Command className="[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:h-5 [&_[cmdk-input-wrapper]_svg]:w-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:h-5 [&_[cmdk-item]_svg]:w-5">
<Command className="[&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:font-medium [&_[cmdk-group-heading]]:text-muted-foreground [&_[cmdk-group]:not([hidden])_~[cmdk-group]]:pt-0 [&_[cmdk-group]]:px-2 [&_[cmdk-input-wrapper]_svg]:size-5 [&_[cmdk-input]]:h-12 [&_[cmdk-item]]:px-2 [&_[cmdk-item]]:py-3 [&_[cmdk-item]_svg]:size-5">
{children}
</Command>
</DialogContent>
@@ -39,8 +39,9 @@ const CommandInput = React.forwardRef<
React.ElementRef<typeof CommandPrimitive.Input>,
React.ComponentPropsWithoutRef<typeof CommandPrimitive.Input>
>(({ className, ...props }, ref) => (
// eslint-disable-next-line react/no-unknown-property
<div className="flex items-center border-b px-3" cmdk-input-wrapper="">
<Search className="mr-2 h-4 w-4 shrink-0 opacity-50" />
<Search className="mr-2 size-4 shrink-0 opacity-50" />
<CommandPrimitive.Input
ref={ref}
className={cn(
+1 -1
View File
@@ -43,7 +43,7 @@ const DialogContent = React.forwardRef<
>
{children}
<DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground">
<X className="h-4 w-4" />
<X className="size-4" />
<span className="sr-only">Close</span>
</DialogPrimitive.Close>
</DialogPrimitive.Content>
+2 -2
View File
@@ -35,11 +35,11 @@ export const Image = ({
}
return (
<div className={cn("bg-stone-100 rounded overflow-hidden", className)}>
<div className={cn("overflow-hidden rounded bg-stone-100", className)}>
<img
{...props}
onError={errorHandle}
className={cn(hidden && "hidden", "object-cover size-full")}
className={cn(hidden && "hidden", "size-full object-cover")}
src={imgSrc}
/>
</div>
+6 -6
View File
@@ -24,7 +24,7 @@ const SelectTrigger = React.forwardRef<
>
{children}
<SelectPrimitive.Icon asChild>
<ChevronDown className="h-4 w-4 opacity-50" />
<ChevronDown className="size-4 opacity-50" />
</SelectPrimitive.Icon>
</SelectPrimitive.Trigger>
))
@@ -42,7 +42,7 @@ const SelectScrollUpButton = React.forwardRef<
)}
{...props}
>
<ChevronUp className="h-4 w-4" />
<ChevronUp className="size-4" />
</SelectPrimitive.ScrollUpButton>
))
SelectScrollUpButton.displayName = SelectPrimitive.ScrollUpButton.displayName
@@ -59,7 +59,7 @@ const SelectScrollDownButton = React.forwardRef<
)}
{...props}
>
<ChevronDown className="h-4 w-4" />
<ChevronDown className="size-4" />
</SelectPrimitive.ScrollDownButton>
))
SelectScrollDownButton.displayName =
@@ -73,7 +73,7 @@ const SelectContent = React.forwardRef<
<SelectPrimitive.Content
ref={ref}
className={cn(
"relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
"relative z-50 max-h-96 min-w-32 overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2",
position === "popper" &&
"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",
className,
@@ -121,9 +121,9 @@ const SelectItem = React.forwardRef<
)}
{...props}
>
<span className="absolute left-2 flex h-3.5 w-3.5 items-center justify-center">
<span className="absolute left-2 flex size-3.5 items-center justify-center">
<SelectPrimitive.ItemIndicator>
<Check className="h-4 w-4" />
<Check className="size-4" />
</SelectPrimitive.ItemIndicator>
</span>
+1 -1
View File
@@ -17,7 +17,7 @@ const Switch = React.forwardRef<
>
<SwitchPrimitives.Thumb
className={cn(
"pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0",
"pointer-events-none block size-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0",
)}
/>
</SwitchPrimitives.Root>
+2 -2
View File
@@ -12,7 +12,7 @@ const TabsList = React.forwardRef<
<TabsPrimitive.List
ref={ref}
className={cn(
"inline-flex items-center justify-center text-muted-foreground border-b",
"inline-flex items-center justify-center border-b text-muted-foreground",
className,
)}
{...props}
@@ -27,7 +27,7 @@ const TabsTrigger = React.forwardRef<
<TabsPrimitive.Trigger
ref={ref}
className={cn(
"inline-flex items-center justify-center whitespace-nowrap px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 border-transparent data-[state=active]:border-foreground border-b-2 data-[state=active]:text-foreground",
"inline-flex items-center justify-center whitespace-nowrap border-b-2 border-transparent px-3 py-1.5 text-sm font-medium ring-offset-background transition-all focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 data-[state=active]:border-foreground data-[state=active]:text-foreground",
className,
)}
{...props}
+1 -1
View File
@@ -81,7 +81,7 @@ const ToastClose = React.forwardRef<
toast-close=""
{...props}
>
<X className="h-4 w-4" />
<X className="size-4" />
</ToastPrimitives.Close>
))
ToastClose.displayName = ToastPrimitives.Close.displayName
+2 -2
View File
@@ -22,11 +22,11 @@ export function UserButton({
return (
<div
className={cn(
"h-20 flex items-center gap-2 justify-center py-2 px-5 rounded-xl font-medium bg-stone-300 text-zinc-600",
"flex h-20 items-center justify-center gap-2 rounded-xl bg-stone-300 px-5 py-2 font-medium text-zinc-600",
className,
)}
>
<Avatar className="w-auto h-full aspect-square">
<Avatar className="aspect-square h-full w-auto">
<AvatarImage src={session?.user?.image || undefined} />
<AvatarFallback>{session?.user?.name?.slice(0, 2)}</AvatarFallback>
</Avatar>
+18 -12
View File
@@ -1,10 +1,11 @@
import { useToast } from "@renderer/components/ui/use-toast"
import { ofetch } from "ofetch"
import { ofetch, type FetchError } from "ofetch"
import {
QueryKey,
useMutation,
useQuery,
useQueryClient,
type InfiniteData,
} from "@tanstack/react-query"
import { client } from "@renderer/lib/client"
import { EntriesResponse, ListResponse } from "@renderer/lib/types"
@@ -23,8 +24,8 @@ export const useEntryActions = ({
try {
await ofetch("http://localhost:41595")
return true
} catch (error: any) {
return error.data?.code === 401
} catch (error: unknown) {
return (error as FetchError).data?.code === 401
}
},
})
@@ -50,15 +51,20 @@ export const useEntryActions = ({
const entriesData = queryClient.getQueriesData({
queryKey: ["entries"],
})
entriesData.forEach(([key, data]: [QueryKey, any]) => {
const list = (data?.pages?.[0] as ListResponse<EntriesResponse>).data
list?.forEach((item) => {
if (item.id === entry.id) {
item.collections = target
queryClient.setQueryData(key, data)
}
})
})
entriesData.forEach(
([key, data]: [
QueryKey,
InfiniteData<ListResponse<EntriesResponse>>,
]) => {
const list = data?.pages?.[0]?.data
list?.forEach((item) => {
if (item.id === entry.id) {
item.collections = target
queryClient.setQueryData(key, data)
}
})
},
)
}
const collect = useMutation({
+1 -1
View File
@@ -13,7 +13,7 @@ export const apiFetch = ofetch.create({
if (options.body instanceof FormData) {
options.body.append("csrfToken", csrfToken)
} else {
;(options.body as Record<string, any>).csrfToken = csrfToken
;(options.body as Record<string, unknown>).csrfToken = csrfToken
}
}
},
@@ -44,7 +44,7 @@ export function Component() {
]
return (
<div className="flex flex-col gap-8 items-center justify-center w-full overflow-y-auto">
<div className="flex w-full flex-col items-center justify-center gap-8 overflow-y-auto">
<div className="text-2xl font-bold">Follow</div>
<Tabs defaultValue="General">
<TabsList className="w-full">
@@ -59,7 +59,7 @@ export function Component() {
))}
</TabsList>
{tabs.map((tab) => (
<TabsContent key={tab.name} value={tab.name} className="h-96 mt-8">
<TabsContent key={tab.name} value={tab.name} className="mt-8 h-96">
{tab.value === "import" ? (
<FollowImport />
) : (
@@ -17,7 +17,7 @@ export function Component() {
<>
<div
className={cn(
"pt-10 border-r shrink-0 h-full overflow-y-auto",
"h-full shrink-0 overflow-y-auto border-r pt-10",
activeList && wideMode.includes(activeList.view)
? "flex-1"
: "w-[340px]",
@@ -9,7 +9,7 @@ export function Component() {
useMainLayoutContext()
return (
<div className="flex h-full">
<div className="w-64 pt-10 border-r shrink-0 bg-native">
<div className="w-64 shrink-0 border-r bg-native pt-10">
<FeedColumn />
</div>
<MainLayoutOutlet
@@ -12,21 +12,21 @@ export function Component() {
const { data: session } = useSession()
return (
<div className="flex gap-10 w-full px-10 py-16">
<div className="flex flex-col gap-8 flex-1 pt-20 min-w-40">
<Avatar className="w-32 h-32 aspect-square">
<div className="flex w-full gap-10 px-10 py-16">
<div className="flex min-w-40 flex-1 flex-col gap-8 pt-20">
<Avatar className="aspect-square size-32">
<AvatarImage src={session?.user?.image || undefined} />
<AvatarFallback>{session?.user?.name?.slice(0, 2)}</AvatarFallback>
</Avatar>
<div className="font-bold text-4xl">{session?.user?.name}</div>
<div className="text-4xl font-bold">{session?.user?.name}</div>
</div>
<div className="flex-[2] flex flex-col gap-8">
<div className="h-full flex flex-col gap-4">
<div className="font-bold text-2xl">Subscriptions</div>
<div className="flex flex-[2] flex-col gap-8">
<div className="flex h-full flex-col gap-4">
<div className="text-2xl font-bold">Subscriptions</div>
<div className="overflow-y-auto">
{views.map((view, index) => (
<div key={view.name}>
<div className="font-semibold flex items-center gap-2 mb-1">
<div className="mb-1 flex items-center gap-2 font-semibold">
<span className={cn("flex", view.className)}>
{view.icon}
</span>
+3 -3
View File
@@ -26,8 +26,8 @@ export function Component() {
}
return (
<div className="h-screen w-full flex items-center justify-center flex-col gap-10">
<img src="./icon.svg" alt="logo" className="h-20 w-20" />
<div className="flex h-screen w-full flex-col items-center justify-center gap-10">
<img src="./icon.svg" alt="logo" className="size-20" />
<h1 className="text-3xl font-bold">Log in to Follow</h1>
{redirecting ? (
<div>Redirecting</div>
@@ -52,7 +52,7 @@ export function Component() {
GitHub
</Button>
<Button
className="text-lg bg-blue-500 hover:bg-blue-500/90"
className="bg-blue-500 text-lg hover:bg-blue-500/90"
size="xl"
onClick={() =>
signIn("google", {
+3 -3
View File
@@ -27,9 +27,9 @@ export function Component() {
}, [])
return (
<div className="h-screen w-full flex items-center justify-center flex-col gap-10">
<img src="./icon.svg" alt="logo" className="h-20 w-20" />
<UserButton className="text-2xl bg-stone-100 px-10 py-4" />
<div className="flex h-screen w-full flex-col items-center justify-center gap-10">
<img src="./icon.svg" alt="logo" className="size-20" />
<UserButton className="bg-stone-100 px-10 py-4 text-2xl" />
<h1 className="text-3xl font-bold">
Successfully connected to Follow Account
</h1>
+4 -4
View File
@@ -24,7 +24,7 @@ export function Component() {
const tab = location.pathname.replace(/^\/settings\/?/, "")
return (
<div className="flex flex-col h-screen">
<div className="flex h-screen flex-col">
{/* <div
className="h-10 border-b flex items-center pl-20 text-sm font-medium"
aria-hidden
@@ -32,15 +32,15 @@ export function Component() {
Follow Settings
</div> */}
<div className="flex flex-1">
<div className="border-r w-44 p-3 bg-native pt-10">
<div className="font-bold text-xl flex items-center gap-1 mx-2 mb-5">
<div className="w-44 border-r bg-native p-3 pt-10">
<div className="mx-2 mb-5 flex items-center gap-1 text-xl font-bold">
<img src="./icon.svg" alt="logo" className="size-6" />
Settings
</div>
{tabs.map((t) => (
<Link
key={t.path}
className={`flex items-center font-medium text-[15px] leading-loose rounded-md transition-colors px-2.5 py-[3px] my-1 text-zinc-600 ${
className={`my-1 flex items-center rounded-md px-2.5 py-[3px] text-[15px] font-medium leading-loose text-zinc-600 transition-colors ${
tab === t.path ? "bg-native-active text-zinc-900" : ""
}`}
to={`/settings/${t.path}`}