feat: subscribe dialog

This commit is contained in:
DIYgod 2024-04-30 15:26:20 +08:00
parent e1fda34428
commit 4e898dcfd2
No known key found for this signature in database
7 changed files with 378 additions and 7 deletions

View File

@ -31,6 +31,7 @@
"@hono/auth-js": "1.0.4",
"@radix-ui/react-avatar": "1.0.4",
"@radix-ui/react-collapsible": "1.0.3",
"@radix-ui/react-dialog": "1.0.5",
"@radix-ui/react-slot": "1.0.2",
"@radix-ui/react-tabs": "1.0.4",
"@radix-ui/react-tooltip": "1.0.7",
@ -46,6 +47,7 @@
"framer-motion": "11.1.7",
"hast-util-to-jsx-runtime": "2.3.0",
"lethargy": "1.0.9",
"lucide-react": "0.376.0",
"react-router-dom": "6.23.0",
"rehype-infer-description-meta": "2.0.0",
"rehype-parse": "9.0.0",

View File

@ -26,6 +26,9 @@ importers:
'@radix-ui/react-collapsible':
specifier: 1.0.3
version: 1.0.3(@types/react-dom@18.3.0)(@types/react@18.3.0)(react-dom@18.3.0(react@18.3.0))(react@18.3.0)
'@radix-ui/react-dialog':
specifier: 1.0.5
version: 1.0.5(@types/react-dom@18.3.0)(@types/react@18.3.0)(react-dom@18.3.0(react@18.3.0))(react@18.3.0)
'@radix-ui/react-slot':
specifier: 1.0.2
version: 1.0.2(@types/react@18.3.0)(react@18.3.0)
@ -71,6 +74,9 @@ importers:
lethargy:
specifier: 1.0.9
version: 1.0.9
lucide-react:
specifier: 0.376.0
version: 0.376.0(react@18.3.0)
react-router-dom:
specifier: 6.23.0
version: 6.23.0(react-dom@18.3.0(react@18.3.0))(react@18.3.0)
@ -882,6 +888,19 @@ packages:
'@types/react':
optional: true
'@radix-ui/react-dialog@1.0.5':
resolution: {integrity: sha512-GjWJX/AUpB703eEBanuBnIWdIXg6NvJFCXcNlSZk4xdszCdhrJgBoUd1cGk67vFO+WdA2pfI/plOpqz/5GUP6Q==}
peerDependencies:
'@types/react': '*'
'@types/react-dom': '*'
react: ^16.8 || ^17.0 || ^18.0
react-dom: ^16.8 || ^17.0 || ^18.0
peerDependenciesMeta:
'@types/react':
optional: true
'@types/react-dom':
optional: true
'@radix-ui/react-direction@1.0.1':
resolution: {integrity: sha512-RXcvnXgyvYvBEOhCBuddKecVkoMiI10Jcm5cTI7abJRAHYfFxeu+FBQs/DvdxSYucxR5mna0dNsL6QFlds5TMA==}
peerDependencies:
@ -904,6 +923,28 @@ packages:
'@types/react-dom':
optional: true
'@radix-ui/react-focus-guards@1.0.1':
resolution: {integrity: sha512-Rect2dWbQ8waGzhMavsIbmSVCgYxkXLxxR3ZvCX79JOglzdEy4JXMb98lq4hPxUbLr77nP0UOGf4rcMU+s1pUA==}
peerDependencies:
'@types/react': '*'
react: ^16.8 || ^17.0 || ^18.0
peerDependenciesMeta:
'@types/react':
optional: true
'@radix-ui/react-focus-scope@1.0.4':
resolution: {integrity: sha512-sL04Mgvf+FmyvZeYfNu1EPAaaxD+aw7cYeIB9L9Fvq8+urhltTRaEo5ysKOpHuKPclsZcSUMKlN05x4u+CINpA==}
peerDependencies:
'@types/react': '*'
'@types/react-dom': '*'
react: ^16.8 || ^17.0 || ^18.0
react-dom: ^16.8 || ^17.0 || ^18.0
peerDependenciesMeta:
'@types/react':
optional: true
'@types/react-dom':
optional: true
'@radix-ui/react-id@1.0.1':
resolution: {integrity: sha512-tI7sT/kqYp8p96yGWY1OAnLHrqDgzHefRBKQ2YAkBS5ja7QLcZ9Z/uY7bEjPUatf8RomoXM8/1sMj1IJaE5UzQ==}
peerDependencies:
@ -1470,6 +1511,10 @@ packages:
argparse@2.0.1:
resolution: {integrity: sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==}
aria-hidden@1.2.4:
resolution: {integrity: sha512-y+CcFFwelSXpLZk/7fMB2mUbGtX9lKycf1MWJ7CaTIERyitVlyQx6C+sxcROU2BAJ24OiZyK+8wj2i8AlBoS3A==}
engines: {node: '>=10'}
array-buffer-byte-length@1.0.1:
resolution: {integrity: sha512-ahC5W1xgou+KTXix4sAO8Ki12Q+jf4i0+tmk3sC+zgcynshkHxzpXdImBehiUYKKKDwvfFiJl1tZt6ewscS1Mg==}
engines: {node: '>= 0.4'}
@ -1886,6 +1931,9 @@ packages:
resolution: {integrity: sha512-bwy0MGW55bG41VqxxypOsdSdGqLwXPI/focwgTYCFMbdUiBAxLg9CFzG08sz2aqzknwiX7Hkl0bQENjg8iLByw==}
engines: {node: '>=8'}
detect-node-es@1.1.0:
resolution: {integrity: sha512-ypdmJU/TbBby2Dxibuv7ZLW3Bs1QEmM7nHjEANfohJLvE0XVujisn1qPJcZxg+qDucsr+bP6fLD1rPS3AhJ7EQ==}
detect-node@2.1.0:
resolution: {integrity: sha512-T0NIuQpnTvFDATNuHN5roPwSBG83rFsuO+MXXH9/3N1eFbn4wcPjttvjMLEPWJ0RGUYgQE7cGgS3tNxbqCGM7g==}
@ -2289,6 +2337,10 @@ packages:
resolution: {integrity: sha512-5uYhsJH8VJBTv7oslg4BznJYhDoRI6waYCxMmCdnTrcCrHA/fCFKoTFz2JKKE0HdDFUF7/oQuhzumXJK7paBRQ==}
engines: {node: '>= 0.4'}
get-nonce@1.0.1:
resolution: {integrity: sha512-FJhYRoDaiatfEkUK8HKlicmu/3SGFD51q3itKDGoSTysQJBnfOcxU5GxnhE1E6soB76MbT0MBtnKJuXyAx+96Q==}
engines: {node: '>=6'}
get-stream@5.2.0:
resolution: {integrity: sha512-nBF+F1rAZVCu/p7rjzgA+Yb4lfYXrpl7a6VmJrU8wF9I1CKvP/QwPNZHnOlwbTkY6dvtFIzFMSyQXbLoTQPRpA==}
engines: {node: '>=8'}
@ -2528,6 +2580,9 @@ packages:
resolution: {integrity: sha512-NGnrKwXzSms2qUUih/ILZ5JBqNTSa1+ZmP6flaIp6KmSElgE9qdndzS3cqjrDovwFdmwsGsLdeFgB6suw+1e9g==}
engines: {node: '>= 0.4'}
invariant@2.2.4:
resolution: {integrity: sha512-phJfQVBuaJM5raOpJjSfkiD6BpbCE4Ns//LaXl6wGYtUBY83nWS6Rf9tXm2e8VaK60JEjYldbPif/A2B1C2gNA==}
ip-address@9.0.5:
resolution: {integrity: sha512-zHtQzGojZXTwZTHQqra+ETKd4Sn3vgi7uBmlPoXVWZqYvuKmtI0l/VZTjqGmJY9x88GGOaZ9+G9ES8hC4T4X8g==}
engines: {node: '>= 12'}
@ -2884,6 +2939,11 @@ packages:
resolution: {integrity: sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==}
engines: {node: '>=12'}
lucide-react@0.376.0:
resolution: {integrity: sha512-g91IX3ERD6yUR1TL2dsL4BkcGygpZz/EsqjAeL/kcRQV0EApIOr/9eBfKhYOVyQIcGGuotFGjF3xKLHMEz+b7g==}
peerDependencies:
react: ^16.5.1 || ^17.0.0 || ^18.0.0
magic-string@0.30.10:
resolution: {integrity: sha512-iIRwTIf0QKV3UAnYK4PU8uiEc4SRh5jX0mwpIwETPpHdhVM4f53RSwS/vXvN1JhGX+Cs7B8qIq3d6AH49O5fAQ==}
@ -3417,6 +3477,26 @@ packages:
resolution: {integrity: sha512-wViHqhAd8OHeLS/IRMJjTSDHF3U9eWi62F/MledQGPdJGDhodXJ9PBLNGr6WWL7qlH12Mt3TyTpbS+hGXMjCzQ==}
engines: {node: '>=0.10.0'}
react-remove-scroll-bar@2.3.6:
resolution: {integrity: sha512-DtSYaao4mBmX+HDo5YWYdBWQwYIQQshUV/dVxFxK+KM26Wjwp1gZ6rv6OC3oujI6Bfu6Xyg3TwK533AQutsn/g==}
engines: {node: '>=10'}
peerDependencies:
'@types/react': ^16.8.0 || ^17.0.0 || ^18.0.0
react: ^16.8.0 || ^17.0.0 || ^18.0.0
peerDependenciesMeta:
'@types/react':
optional: true
react-remove-scroll@2.5.5:
resolution: {integrity: sha512-ImKhrzJJsyXJfBZ4bzu8Bwpka14c/fQt0k+cyFp/PBhTfyDnU5hjOtM4AG/0AMyy8oKzOTR0lDgJIM7pYXI0kw==}
engines: {node: '>=10'}
peerDependencies:
'@types/react': ^16.8.0 || ^17.0.0 || ^18.0.0
react: ^16.8.0 || ^17.0.0 || ^18.0.0
peerDependenciesMeta:
'@types/react':
optional: true
react-router-dom@6.23.0:
resolution: {integrity: sha512-Q9YaSYvubwgbal2c9DJKfx6hTNoBp3iJDsl+Duva/DwxoJH+OTXkxGpql4iUK2sla/8z4RpjAm6EWx1qUDuopQ==}
engines: {node: '>=14.0.0'}
@ -3430,6 +3510,16 @@ packages:
peerDependencies:
react: '>=16.8'
react-style-singleton@2.2.1:
resolution: {integrity: sha512-ZWj0fHEMyWkHzKYUr2Bs/4zU6XLmq9HsgBURm7g5pAVfyn49DgUiNgY2d4lXRlYSiCif9YBGpQleewkcqddc7g==}
engines: {node: '>=10'}
peerDependencies:
'@types/react': ^16.8.0 || ^17.0.0 || ^18.0.0
react: ^16.8.0 || ^17.0.0 || ^18.0.0
peerDependenciesMeta:
'@types/react':
optional: true
react@18.3.0:
resolution: {integrity: sha512-RPutkJftSAldDibyrjuku7q11d3oy6wKOyPe5K1HA/HwwrXcEqBdHsLypkC2FFYjP7bPUa6gbzSBhw4sY2JcDg==}
engines: {node: '>=0.10.0'}
@ -3916,6 +4006,26 @@ packages:
uri-js@4.4.1:
resolution: {integrity: sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==}
use-callback-ref@1.3.2:
resolution: {integrity: sha512-elOQwe6Q8gqZgDA8mrh44qRTQqpIHDcZ3hXTLjBe1i4ph8XpNJnO+aQf3NaG+lriLopI4HMx9VjQLfPQ6vhnoA==}
engines: {node: '>=10'}
peerDependencies:
'@types/react': ^16.8.0 || ^17.0.0 || ^18.0.0
react: ^16.8.0 || ^17.0.0 || ^18.0.0
peerDependenciesMeta:
'@types/react':
optional: true
use-sidecar@1.1.2:
resolution: {integrity: sha512-epTbsLuzZ7lPClpz2TyryBfztm7m+28DlEv2ZCQ3MDr5ssiwyOwGH/e5F9CkfWjJ1t4clvI58yF822/GUkjjhw==}
engines: {node: '>=10'}
peerDependencies:
'@types/react': ^16.9.0 || ^17.0.0 || ^18.0.0
react: ^16.8.0 || ^17.0.0 || ^18.0.0
peerDependenciesMeta:
'@types/react':
optional: true
utf8-byte-length@1.0.4:
resolution: {integrity: sha512-4+wkEYLBbWxqTahEsWrhxepcoVOJ+1z5PGIjPZxRkytcdSUaNjIjBM7Xn8E+pdSuV7SzvWovBFA54FO0JSoqhA==}
@ -4726,6 +4836,29 @@ snapshots:
optionalDependencies:
'@types/react': 18.3.0
'@radix-ui/react-dialog@1.0.5(@types/react-dom@18.3.0)(@types/react@18.3.0)(react-dom@18.3.0(react@18.3.0))(react@18.3.0)':
dependencies:
'@babel/runtime': 7.24.4
'@radix-ui/primitive': 1.0.1
'@radix-ui/react-compose-refs': 1.0.1(@types/react@18.3.0)(react@18.3.0)
'@radix-ui/react-context': 1.0.1(@types/react@18.3.0)(react@18.3.0)
'@radix-ui/react-dismissable-layer': 1.0.5(@types/react-dom@18.3.0)(@types/react@18.3.0)(react-dom@18.3.0(react@18.3.0))(react@18.3.0)
'@radix-ui/react-focus-guards': 1.0.1(@types/react@18.3.0)(react@18.3.0)
'@radix-ui/react-focus-scope': 1.0.4(@types/react-dom@18.3.0)(@types/react@18.3.0)(react-dom@18.3.0(react@18.3.0))(react@18.3.0)
'@radix-ui/react-id': 1.0.1(@types/react@18.3.0)(react@18.3.0)
'@radix-ui/react-portal': 1.0.4(@types/react-dom@18.3.0)(@types/react@18.3.0)(react-dom@18.3.0(react@18.3.0))(react@18.3.0)
'@radix-ui/react-presence': 1.0.1(@types/react-dom@18.3.0)(@types/react@18.3.0)(react-dom@18.3.0(react@18.3.0))(react@18.3.0)
'@radix-ui/react-primitive': 1.0.3(@types/react-dom@18.3.0)(@types/react@18.3.0)(react-dom@18.3.0(react@18.3.0))(react@18.3.0)
'@radix-ui/react-slot': 1.0.2(@types/react@18.3.0)(react@18.3.0)
'@radix-ui/react-use-controllable-state': 1.0.1(@types/react@18.3.0)(react@18.3.0)
aria-hidden: 1.2.4
react: 18.3.0
react-dom: 18.3.0(react@18.3.0)
react-remove-scroll: 2.5.5(@types/react@18.3.0)(react@18.3.0)
optionalDependencies:
'@types/react': 18.3.0
'@types/react-dom': 18.3.0
'@radix-ui/react-direction@1.0.1(@types/react@18.3.0)(react@18.3.0)':
dependencies:
'@babel/runtime': 7.24.4
@ -4747,6 +4880,25 @@ snapshots:
'@types/react': 18.3.0
'@types/react-dom': 18.3.0
'@radix-ui/react-focus-guards@1.0.1(@types/react@18.3.0)(react@18.3.0)':
dependencies:
'@babel/runtime': 7.24.4
react: 18.3.0
optionalDependencies:
'@types/react': 18.3.0
'@radix-ui/react-focus-scope@1.0.4(@types/react-dom@18.3.0)(@types/react@18.3.0)(react-dom@18.3.0(react@18.3.0))(react@18.3.0)':
dependencies:
'@babel/runtime': 7.24.4
'@radix-ui/react-compose-refs': 1.0.1(@types/react@18.3.0)(react@18.3.0)
'@radix-ui/react-primitive': 1.0.3(@types/react-dom@18.3.0)(@types/react@18.3.0)(react-dom@18.3.0(react@18.3.0))(react@18.3.0)
'@radix-ui/react-use-callback-ref': 1.0.1(@types/react@18.3.0)(react@18.3.0)
react: 18.3.0
react-dom: 18.3.0(react@18.3.0)
optionalDependencies:
'@types/react': 18.3.0
'@types/react-dom': 18.3.0
'@radix-ui/react-id@1.0.1(@types/react@18.3.0)(react@18.3.0)':
dependencies:
'@babel/runtime': 7.24.4
@ -5402,6 +5554,10 @@ snapshots:
argparse@2.0.1: {}
aria-hidden@1.2.4:
dependencies:
tslib: 2.6.2
array-buffer-byte-length@1.0.1:
dependencies:
call-bind: 1.0.7
@ -5880,6 +6036,8 @@ snapshots:
detect-libc@2.0.3: {}
detect-node-es@1.1.0: {}
detect-node@2.1.0:
optional: true
@ -6502,6 +6660,8 @@ snapshots:
has-symbols: 1.0.3
hasown: 2.0.2
get-nonce@1.0.1: {}
get-stream@5.2.0:
dependencies:
pump: 3.0.0
@ -6854,6 +7014,10 @@ snapshots:
hasown: 2.0.2
side-channel: 1.0.6
invariant@2.2.4:
dependencies:
loose-envify: 1.4.0
ip-address@9.0.5:
dependencies:
jsbn: 1.1.0
@ -7178,6 +7342,10 @@ snapshots:
lru-cache@7.18.3: {}
lucide-react@0.376.0(react@18.3.0):
dependencies:
react: 18.3.0
magic-string@0.30.10:
dependencies:
'@jridgewell/sourcemap-codec': 1.4.15
@ -7843,6 +8011,25 @@ snapshots:
react-refresh@0.14.0: {}
react-remove-scroll-bar@2.3.6(@types/react@18.3.0)(react@18.3.0):
dependencies:
react: 18.3.0
react-style-singleton: 2.2.1(@types/react@18.3.0)(react@18.3.0)
tslib: 2.6.2
optionalDependencies:
'@types/react': 18.3.0
react-remove-scroll@2.5.5(@types/react@18.3.0)(react@18.3.0):
dependencies:
react: 18.3.0
react-remove-scroll-bar: 2.3.6(@types/react@18.3.0)(react@18.3.0)
react-style-singleton: 2.2.1(@types/react@18.3.0)(react@18.3.0)
tslib: 2.6.2
use-callback-ref: 1.3.2(@types/react@18.3.0)(react@18.3.0)
use-sidecar: 1.1.2(@types/react@18.3.0)(react@18.3.0)
optionalDependencies:
'@types/react': 18.3.0
react-router-dom@6.23.0(react-dom@18.3.0(react@18.3.0))(react@18.3.0):
dependencies:
'@remix-run/router': 1.16.0
@ -7855,6 +8042,15 @@ snapshots:
'@remix-run/router': 1.16.0
react: 18.3.0
react-style-singleton@2.2.1(@types/react@18.3.0)(react@18.3.0):
dependencies:
get-nonce: 1.0.1
invariant: 2.2.4
react: 18.3.0
tslib: 2.6.2
optionalDependencies:
'@types/react': 18.3.0
react@18.3.0:
dependencies:
loose-envify: 1.4.0
@ -8492,6 +8688,21 @@ snapshots:
dependencies:
punycode: 2.3.1
use-callback-ref@1.3.2(@types/react@18.3.0)(react@18.3.0):
dependencies:
react: 18.3.0
tslib: 2.6.2
optionalDependencies:
'@types/react': 18.3.0
use-sidecar@1.1.2(@types/react@18.3.0)(react@18.3.0):
dependencies:
detect-node-es: 1.1.0
react: 18.3.0
tslib: 2.6.2
optionalDependencies:
'@types/react': 18.3.0
utf8-byte-length@1.0.4: {}
util-deprecate@1.0.2: {}

View File

@ -13,6 +13,8 @@ import { FeedList } from "./list"
import { ActivedList } from "@renderer/lib/types"
import { UserButton } from "@renderer/components/user-button"
import { views } from "@renderer/lib/constants"
import { Dialog, DialogTrigger } from "@renderer/components/ui/dialog"
import { SubscribeDialog } from "./subscribe-dialog"
const lethargy = new Lethargy()
@ -60,7 +62,7 @@ export function FeedColumn({
return (
<div
className="h-full flex flex-col"
className="h-full flex flex-col gap-3"
onClick={() =>
setActivedList({
level: "view",
@ -70,8 +72,19 @@ export function FeedColumn({
})
}
>
<UserButton className="h-12 mx-3 mb-2 mt-1" />
<div className="flex text-zinc-500 w-full justify-between text-xl my-2 px-5">
<div className="mx-5 flex items-center justify-between">
<div className="font-bold text-xl">ReadOK</div>
<div className="flex items-center gap-2">
<UserButton className="h-5 p-0" hideName={true} />
<Dialog>
<DialogTrigger className="flex">
<i className="i-mingcute-add-circle-line h-5 w-5 text-zinc-500" />
</DialogTrigger>
<SubscribeDialog />
</Dialog>
</div>
</div>
<div className="flex text-zinc-500 w-full justify-between text-xl px-5">
<TooltipProvider delayDuration={300}>
{views.map((item, index) => (
<div
@ -89,7 +102,9 @@ export function FeedColumn({
}}
>
<Tooltip>
<TooltipTrigger>{item.icon}</TooltipTrigger>
<TooltipTrigger className="flex items-center my-2">
{item.icon}
</TooltipTrigger>
<TooltipContent side="bottom">{item.name}</TooltipContent>
</Tooltip>
</div>

View File

@ -26,7 +26,7 @@ export function FeedList({
<div className="w-64 px-3">
<div
className={cn(
"flex items-center justify-between mt-2 mb-3 px-2.5 py-1 cursor-pointer",
"flex items-center justify-between mb-2 px-2.5 py-1 cursor-pointer",
)}
onClick={(e) => {
e.stopPropagation()

View File

@ -0,0 +1,17 @@
import {
DialogContent,
DialogDescription,
DialogHeader,
DialogTitle,
} from "@renderer/components/ui/dialog"
export function SubscribeDialog() {
return (
<DialogContent>
<DialogHeader>
<DialogTitle>Subscribe</DialogTitle>
<DialogDescription>description</DialogDescription>
</DialogHeader>
</DialogContent>
)
}

View File

@ -0,0 +1,120 @@
import * as React from "react"
import * as DialogPrimitive from "@radix-ui/react-dialog"
import { X } from "lucide-react"
import { cn } from "@renderer/lib/utils"
const Dialog = DialogPrimitive.Root
const DialogTrigger = DialogPrimitive.Trigger
const DialogPortal = DialogPrimitive.Portal
const DialogClose = DialogPrimitive.Close
const DialogOverlay = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Overlay>,
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Overlay>
>(({ className, ...props }, ref) => (
<DialogPrimitive.Overlay
ref={ref}
className={cn(
"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
className,
)}
{...props}
/>
))
DialogOverlay.displayName = DialogPrimitive.Overlay.displayName
const DialogContent = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Content>,
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Content>
>(({ className, children, ...props }, ref) => (
<DialogPortal>
<DialogOverlay />
<DialogPrimitive.Content
ref={ref}
className={cn(
"fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 border bg-background p-6 shadow-lg duration-200 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-[state=closed]:slide-out-to-left-1/2 data-[state=closed]:slide-out-to-top-[48%] data-[state=open]:slide-in-from-left-1/2 data-[state=open]:slide-in-from-top-[48%] sm:rounded-lg",
className,
)}
{...props}
>
{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" />
<span className="sr-only">Close</span>
</DialogPrimitive.Close>
</DialogPrimitive.Content>
</DialogPortal>
))
DialogContent.displayName = DialogPrimitive.Content.displayName
const DialogHeader = ({
className,
...props
}: React.HTMLAttributes<HTMLDivElement>) => (
<div
className={cn(
"flex flex-col space-y-1.5 text-center sm:text-left",
className,
)}
{...props}
/>
)
DialogHeader.displayName = "DialogHeader"
const DialogFooter = ({
className,
...props
}: React.HTMLAttributes<HTMLDivElement>) => (
<div
className={cn(
"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",
className,
)}
{...props}
/>
)
DialogFooter.displayName = "DialogFooter"
const DialogTitle = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Title>,
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Title>
>(({ className, ...props }, ref) => (
<DialogPrimitive.Title
ref={ref}
className={cn(
"text-lg font-semibold leading-none tracking-tight",
className,
)}
{...props}
/>
))
DialogTitle.displayName = DialogPrimitive.Title.displayName
const DialogDescription = React.forwardRef<
React.ElementRef<typeof DialogPrimitive.Description>,
React.ComponentPropsWithoutRef<typeof DialogPrimitive.Description>
>(({ className, ...props }, ref) => (
<DialogPrimitive.Description
ref={ref}
className={cn("text-sm text-muted-foreground", className)}
{...props}
/>
))
DialogDescription.displayName = DialogPrimitive.Description.displayName
export {
Dialog,
DialogPortal,
DialogOverlay,
DialogClose,
DialogTrigger,
DialogContent,
DialogHeader,
DialogFooter,
DialogTitle,
DialogDescription,
}

View File

@ -6,7 +6,13 @@ import {
import { useSession } from "@hono/auth-js/react"
import { cn } from "@renderer/lib/utils"
export function UserButton({ className }: { className?: string }) {
export function UserButton({
className,
hideName,
}: {
className?: string
hideName?: boolean
}) {
const { data: session, status } = useSession()
if (status !== "authenticated") {
@ -29,7 +35,7 @@ export function UserButton({ className }: { className?: string }) {
<AvatarImage src={session?.user?.image || undefined} />
<AvatarFallback>{session?.user?.name?.slice(0, 2)}</AvatarFallback>
</Avatar>
<div>{session?.user?.name}</div>
{!hideName && <div>{session?.user?.name}</div>}
</div>
)
}