feat: window traffic light and headers position

This commit is contained in:
DIYgod
2024-06-04 18:36:49 +08:00
parent eafe32ffaf
commit ce7b4ab0ab
9 changed files with 60 additions and 80 deletions
+4
View File
@@ -25,6 +25,10 @@ export function createWindow(options?: {
},
titleBarStyle: "hiddenInset",
trafficLightPosition: {
x: 18,
y: 18,
},
transparent: true,
backgroundColor: "#00000000", // transparent hexadecimal or anything with transparency,
+1 -1
View File
@@ -20,7 +20,7 @@ function App() {
return (
<>
<div
className="drag-region absolute inset-x-0 top-0 h-10 shrink-0"
className="drag-region absolute inset-x-0 top-0 h-12 shrink-0"
aria-hidden
/>
@@ -8,7 +8,7 @@ import {
import { views } from "@renderer/lib/constants"
import { FeedViewType } from "@renderer/lib/enum"
import { buildStorageNS } from "@renderer/lib/ns"
import { cn, getEntriesParams } from "@renderer/lib/utils"
import { getEntriesParams } from "@renderer/lib/utils"
import type { EntryModel } from "@renderer/models"
import { apiClient } from "@renderer/queries/api-fetch"
import { useEntries } from "@renderer/queries/entries"
@@ -194,8 +194,43 @@ const ListHeader: FC = () => {
}, [activeList])
return (
<div className="mb-5 flex w-full items-center justify-between pl-9 pr-2">
<div className="mt-4">
<div className="mb-5 flex w-full flex-col pl-11 pr-4 pt-2.5">
<div className="flex w-full justify-end">
<div className="relative z-[1] flex items-center gap-1 text-zinc-500">
<HeaderActionButton
tooltip={unreadOnly ? "Unread Only" : "All"}
onClick={() => setUnreadOnly(!unreadOnly)}
>
{unreadOnly ? (
<i className="i-mingcute-round-fill" />
) : (
<i className="i-mingcute-round-line" />
)}
</HeaderActionButton>
<Popover open={markPopoverOpen} onOpenChange={setMarkPopoverOpen}>
<PopoverTrigger>
<HeaderActionButton onClick={() => {}} tooltip="Mark All as Read">
<i className="i-mingcute-check-circle-line" />
</HeaderActionButton>
</PopoverTrigger>
<PopoverContent className="flex w-fit flex-col items-center justify-center gap-3 text-[15px] font-medium">
<div>Mark all as read?</div>
<div className="space-x-4">
<PopoverClose>
<Button size="sm" variant="outline">
Cancel
</Button>
</PopoverClose>
{/* TODO */}
<Button size="sm" onClick={handleMarkAllAsRead}>
Confirm
</Button>
</div>
</PopoverContent>
</Popover>
</div>
</div>
<div className="mt-[18px]">
<div className="text-lg font-bold leading-none">{activeList?.name}</div>
<div className="text-xs font-medium text-zinc-400">
{entries.data?.pages?.[0].total || 0}
@@ -205,50 +240,6 @@ const ListHeader: FC = () => {
Items
</div>
</div>
<div className="relative z-[1] flex h-14 items-center gap-1 text-zinc-500">
<HeaderActionButton onClick={entries.refetch} tooltip="Refresh">
<i
className={cn(
"i-mingcute-refresh-2-line",
entries.isRefetching && "animate-spin",
)}
/>
</HeaderActionButton>
<HeaderActionButton
tooltip={unreadOnly ? "Unread Only" : "All"}
onClick={() => setUnreadOnly(!unreadOnly)}
active={unreadOnly}
>
{unreadOnly ? (
<i className="i-mingcute-round-fill" />
) : (
<i className="i-mingcute-round-line" />
)}
</HeaderActionButton>
<Popover open={markPopoverOpen} onOpenChange={setMarkPopoverOpen}>
<PopoverTrigger>
<HeaderActionButton onClick={() => {}} tooltip="Mark All as Read">
<i className="i-mingcute-check-circle-line" />
</HeaderActionButton>
</PopoverTrigger>
<PopoverContent className="flex w-fit flex-col items-center justify-center gap-3 text-[15px] font-medium">
<div>Mark all as read?</div>
<div className="space-x-4">
<PopoverClose>
<Button size="sm" variant="outline">
Cancel
</Button>
</PopoverClose>
{/* TODO */}
<Button size="sm" onClick={handleMarkAllAsRead}>
Confirm
</Button>
</div>
</PopoverContent>
</Popover>
</div>
</div>
)
}
@@ -21,7 +21,7 @@ export function EntryShare({
if (!entry?.entries.url) return null
return (
<div className="flex h-14 items-center justify-end gap-3 px-5 text-lg text-zinc-500">
<div className="flex items-center justify-end gap-3 px-5 pt-2.5 text-lg text-zinc-500">
<TooltipProvider>
{items
.filter((item) => !item.disabled)
@@ -1,4 +1,4 @@
import { Button } from "@renderer/components/ui/button"
import { Button, HeaderActionButton } from "@renderer/components/ui/button"
import {
Tooltip,
TooltipContent,
@@ -67,33 +67,18 @@ export function FeedColumn() {
preventNavigate: true,
})}
>
<div className="ml-5 mr-3 flex items-center justify-between">
<div
className="flex items-center gap-1 text-xl font-bold"
onClick={(e) => {
e.stopPropagation()
setActiveList({
level: levels.view,
id: active,
name: views[active].name,
view: active,
})
}}
>
<img src="./icon.svg" alt="logo" className="size-6" />
Follow
</div>
<div className="flex items-center">
<Button variant="ghost" size="sm">
<Link to="/profile" className="flex">
<div className="ml-5 mr-3 flex items-center justify-end">
<div className="flex items-center gap-2">
<Link to="/profile">
<HeaderActionButton tooltip="Profile">
<UserButton className="h-5 p-0" hideName />
</Link>
</Button>
<Button className="hover:bg-theme-vibrancyBg" variant="ghost" size="sm">
<Link to="/discover" className="flex">
</HeaderActionButton>
</Link>
<Link to="/discover">
<HeaderActionButton tooltip="Add">
<i className="i-mingcute-add-line size-5 text-theme-vibrancyFg" />
</Link>
</Button>
</HeaderActionButton>
</Link>
</div>
</div>
<div className="flex w-full justify-between px-3 text-xl text-theme-vibrancyFg">
+1 -1
View File
@@ -71,7 +71,7 @@ Button.displayName = "Button"
// BIZ buttons
interface HeaderActionButtonProps {
onClick: () => void
onClick?: () => void
icon?: React.ReactNode | React.FC<ComponentType>
tooltip: string
tooltipSide?: "top" | "bottom"
@@ -5,7 +5,7 @@ import { Outlet } from "react-router-dom"
export function Component() {
return (
<div className="flex h-full">
<div className={cn("w-64 shrink-0 border-r backdrop-blur", window.electron ? "pt-10" : "pt-4")}>
<div className={cn("w-64 shrink-0 border-r pt-2.5 backdrop-blur")}>
<FeedColumn />
</div>
<div className="flex flex-1 bg-background">
+1 -1
View File
@@ -117,7 +117,7 @@ export function Component() {
)
return (
<div className="flex h-full flex-col bg-background/90 p-10">
<div className="flex h-full flex-col bg-background/90 px-[18px] pb-[18px] pt-12">
<div className="mb-4 mt-2 flex items-center gap-2 text-[22px] font-bold">
<img src="../icon.svg" alt="logo" className="size-8" />
Add follow
+2 -2
View File
@@ -32,8 +32,8 @@ export function Component() {
Follow Settings
</div> */}
<div className="flex flex-1">
<div className="w-44 border-r p-3 pt-10 backdrop-blur">
<div className="mx-2 mb-5 flex items-center gap-1 text-xl font-bold">
<div className="w-44 border-r p-3 pt-12 backdrop-blur">
<div className="mx-2 mb-3 flex items-center gap-1 text-xl font-bold">
<img src="./icon.svg" alt="logo" className="size-6" />
Settings
</div>