Browse Source

fix: 🐛

imwald
codytseng 1 year ago
parent
commit
1e3c74a28f
  1. 4
      src/renderer/src/components/AboutInfoDialog/index.tsx
  2. 2
      src/renderer/src/components/AccountButton/ProfileButton.tsx
  3. 1
      src/renderer/src/components/NoteCard/ShortTextNoteCard.tsx
  4. 14
      src/renderer/src/components/NoteStats/NoteOptions/index.tsx
  5. 13
      src/renderer/src/components/Sidebar/index.tsx
  6. 7
      src/renderer/src/components/ui/dialog.tsx
  7. 6
      src/renderer/src/layouts/PrimaryPageLayout/index.tsx
  8. 6
      src/renderer/src/layouts/SecondaryPageLayout/index.tsx
  9. 10
      src/renderer/src/pages/primary/NoteListPage/index.tsx

4
src/renderer/src/components/AboutInfoDialog/index.tsx

@ -15,7 +15,9 @@ export default function AboutInfoDialog({ children }: { children: React.ReactNod
<DialogContent> <DialogContent>
<DialogHeader> <DialogHeader>
<DialogTitle>Jumble</DialogTitle> <DialogTitle>Jumble</DialogTitle>
<DialogDescription>yet another nostr client</DialogDescription> <DialogDescription>
A beautiful nostr client focused on browsing relay feeds
</DialogDescription>
</DialogHeader> </DialogHeader>
<div> <div>
Made by{' '} Made by{' '}

2
src/renderer/src/components/AccountButton/ProfileButton.tsx

@ -32,7 +32,7 @@ export default function ProfileButton({
if (variant === 'titlebar') { if (variant === 'titlebar') {
triggerComponent = ( triggerComponent = (
<button> <button>
<Avatar className="ml-2 w-7 h-7 hover:opacity-90"> <Avatar className="w-7 h-7 hover:opacity-90">
<AvatarImage src={avatar} /> <AvatarImage src={avatar} />
<AvatarFallback> <AvatarFallback>
<img src={defaultAvatar} /> <img src={defaultAvatar} />

1
src/renderer/src/components/NoteCard/ShortTextNoteCard.tsx

@ -35,6 +35,7 @@ export default function ShortTextNoteCard({
<RepostDescription reposter={reposter} className="max-sm:hidden pl-4" /> <RepostDescription reposter={reposter} className="max-sm:hidden pl-4" />
<div <div
className={`hover:bg-muted/50 text-left cursor-pointer ${embedded ? 'p-2 sm:p-3 border rounded-lg' : 'px-4 py-3 sm:py-4 sm:border sm:rounded-lg max-sm:border-b'}`} className={`hover:bg-muted/50 text-left cursor-pointer ${embedded ? 'p-2 sm:p-3 border rounded-lg' : 'px-4 py-3 sm:py-4 sm:border sm:rounded-lg max-sm:border-b'}`}
onClick={(e) => e.stopPropagation()}
> >
<RepostDescription reposter={reposter} className="sm:hidden" /> <RepostDescription reposter={reposter} className="sm:hidden" />
<Note <Note

14
src/renderer/src/components/NoteStats/NoteOptions/index.tsx

@ -8,8 +8,8 @@ import { getSharableEventId } from '@renderer/lib/event'
import { Code, Copy, Ellipsis } from 'lucide-react' import { Code, Copy, Ellipsis } from 'lucide-react'
import { Event } from 'nostr-tools' import { Event } from 'nostr-tools'
import { useState } from 'react' import { useState } from 'react'
import RawEventDialog from './RawEventDialog'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import RawEventDialog from './RawEventDialog'
export default function NoteOptions({ event }: { event: Event }) { export default function NoteOptions({ event }: { event: Event }) {
const { t } = useTranslation() const { t } = useTranslation()
@ -26,20 +26,12 @@ export default function NoteOptions({ event }: { event: Event }) {
</DropdownMenuTrigger> </DropdownMenuTrigger>
<DropdownMenuContent collisionPadding={8}> <DropdownMenuContent collisionPadding={8}>
<DropdownMenuItem <DropdownMenuItem
onClick={(e) => { onClick={() => navigator.clipboard.writeText('nostr:' + getSharableEventId(event))}
e.stopPropagation()
navigator.clipboard.writeText('nostr:' + getSharableEventId(event))
}}
> >
<Copy /> <Copy />
{t('copy embedded code')} {t('copy embedded code')}
</DropdownMenuItem> </DropdownMenuItem>
<DropdownMenuItem <DropdownMenuItem onClick={() => setIsRawEventDialogOpen(true)}>
onClick={(e) => {
e.stopPropagation()
setIsRawEventDialogOpen(true)
}}
>
<Code /> <Code />
{t('raw event')} {t('raw event')}
</DropdownMenuItem> </DropdownMenuItem>

13
src/renderer/src/components/Sidebar/index.tsx

@ -1,8 +1,6 @@
import Logo from '@renderer/assets/Logo' import Logo from '@renderer/assets/Logo'
import { Button } from '@renderer/components/ui/button' import { Button } from '@renderer/components/ui/button'
import { IS_ELECTRON } from '@renderer/lib/env' import { IS_ELECTRON } from '@renderer/lib/env'
import { toHome } from '@renderer/lib/link'
import { SecondaryPageLink } from '@renderer/PageManager'
import { Info } from 'lucide-react' import { Info } from 'lucide-react'
import { useTranslation } from 'react-i18next' import { useTranslation } from 'react-i18next'
import AboutInfoDialog from '../AboutInfoDialog' import AboutInfoDialog from '../AboutInfoDialog'
@ -16,18 +14,17 @@ import SearchButton from '../SearchButton'
export default function PrimaryPageSidebar() { export default function PrimaryPageSidebar() {
const { t } = useTranslation() const { t } = useTranslation()
return ( return (
<div className="draggable w-52 h-full shrink-0 hidden xl:flex flex-col pb-8 pt-10 pl-4 justify-between"> <div className="w-52 h-full shrink-0 hidden xl:flex flex-col pb-8 pt-10 pl-4 justify-between relative">
<div className="draggable absolute top-0 left-0 h-11 w-full" />
<div className="space-y-2"> <div className="space-y-2">
<div className="ml-4 mb-8 w-40"> <div className="draggable ml-4 mb-8 w-40">
<SecondaryPageLink to={toHome()}> <Logo />
<Logo />
</SecondaryPageLink>
</div> </div>
<PostButton variant="sidebar" /> <PostButton variant="sidebar" />
<RelaySettingsButton variant="sidebar" /> <RelaySettingsButton variant="sidebar" />
<NotificationButton variant="sidebar" /> <NotificationButton variant="sidebar" />
<SearchButton variant="sidebar" /> <SearchButton variant="sidebar" />
<RefreshButton variant="sidebar" /> {IS_ELECTRON && <RefreshButton variant="sidebar" />}
{!IS_ELECTRON && ( {!IS_ELECTRON && (
<AboutInfoDialog> <AboutInfoDialog>
<Button variant="sidebar" size="sidebar"> <Button variant="sidebar" size="sidebar">

7
src/renderer/src/components/ui/dialog.tsx

@ -22,7 +22,6 @@ const DialogOverlay = React.forwardRef<
'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', '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 className
)} )}
onClick={(e) => e.stopPropagation()}
{...props} {...props}
/> />
)) ))
@ -40,15 +39,11 @@ const DialogContent = React.forwardRef<
'fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 sm: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', 'fixed left-[50%] top-[50%] z-50 grid w-full max-w-lg translate-x-[-50%] translate-y-[-50%] gap-4 sm: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 className
)} )}
onClick={(e) => e.stopPropagation()}
{...props} {...props}
> >
{children} {children}
{!withoutClose && ( {!withoutClose && (
<DialogPrimitive.Close <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">
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"
onClick={(e) => e.stopPropagation()}
>
<X className="h-4 w-4" /> <X className="h-4 w-4" />
<span className="sr-only">Close</span> <span className="sr-only">Close</span>
</DialogPrimitive.Close> </DialogPrimitive.Close>

6
src/renderer/src/layouts/PrimaryPageLayout/index.tsx

@ -9,7 +9,7 @@ import SearchButton from '@renderer/components/SearchButton'
import ThemeToggle from '@renderer/components/ThemeToggle' import ThemeToggle from '@renderer/components/ThemeToggle'
import { Titlebar } from '@renderer/components/Titlebar' import { Titlebar } from '@renderer/components/Titlebar'
import { ScrollArea } from '@renderer/components/ui/scroll-area' import { ScrollArea } from '@renderer/components/ui/scroll-area'
import { isMacOS } from '@renderer/lib/env' import { IS_ELECTRON, isMacOS } from '@renderer/lib/env'
import { cn } from '@renderer/lib/utils' import { cn } from '@renderer/lib/utils'
import { useScreenSize } from '@renderer/providers/ScreenSizeProvider' import { useScreenSize } from '@renderer/providers/ScreenSizeProvider'
import { forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react' import { forwardRef, useEffect, useImperativeHandle, useRef, useState } from 'react'
@ -60,7 +60,7 @@ const PrimaryPageLayout = forwardRef(({ children }: { children?: React.ReactNode
<ScrollArea <ScrollArea
ref={scrollAreaRef} ref={scrollAreaRef}
className="h-full w-full" className="h-full w-full"
scrollBarClassName="pt-9 max-sm:pt-0 xl:pt-0" scrollBarClassName={`pt-9 xl:pt-0 ${isMacOS() ? 'max-sm:pt-20' : 'max-sm:pt-11'}`}
> >
<PrimaryPageTitlebar visible={visible} /> <PrimaryPageTitlebar visible={visible} />
<div className={cn('sm:px-4 pb-4 pt-11 xl:pt-4', isMacOS() ? 'max-sm:pt-20' : '')}> <div className={cn('sm:px-4 pb-4 pt-11 xl:pt-4', isMacOS() ? 'max-sm:pt-20' : '')}>
@ -111,7 +111,7 @@ function PrimaryPageTitlebar({ visible = true }: { visible?: boolean }) {
<SearchButton /> <SearchButton />
</div> </div>
<div className="flex gap-2 items-center"> <div className="flex gap-2 items-center">
<RefreshButton /> {IS_ELECTRON && <RefreshButton />}
<RelaySettingsButton /> <RelaySettingsButton />
<NotificationButton /> <NotificationButton />
</div> </div>

6
src/renderer/src/layouts/SecondaryPageLayout/index.tsx

@ -51,7 +51,11 @@ export default function SecondaryPageLayout({
}, [lastScrollTop]) }, [lastScrollTop])
return ( return (
<ScrollArea ref={scrollAreaRef} className="h-full" scrollBarClassName="pt-9"> <ScrollArea
ref={scrollAreaRef}
className="h-full"
scrollBarClassName={`sm:pt-9 ${isMacOS() ? 'pt-20' : 'pt-11'}`}
>
<SecondaryPageTitlebar <SecondaryPageTitlebar
content={titlebarContent} content={titlebarContent}
hideBackButton={hideBackButton} hideBackButton={hideBackButton}

10
src/renderer/src/pages/primary/NoteListPage/index.tsx

@ -5,10 +5,18 @@ import { Popover, PopoverContent, PopoverTrigger } from '@renderer/components/ui
import { ScrollArea } from '@renderer/components/ui/scroll-area' import { ScrollArea } from '@renderer/components/ui/scroll-area'
import PrimaryPageLayout from '@renderer/layouts/PrimaryPageLayout' import PrimaryPageLayout from '@renderer/layouts/PrimaryPageLayout'
import { useRelaySettings } from '@renderer/providers/RelaySettingsProvider' import { useRelaySettings } from '@renderer/providers/RelaySettingsProvider'
import { useEffect, useRef } from 'react'
export default function NoteListPage() { export default function NoteListPage() {
const layoutRef = useRef<{ scrollToTop: () => void }>(null)
const { relayUrls } = useRelaySettings() const { relayUrls } = useRelaySettings()
useEffect(() => {
if (layoutRef.current) {
layoutRef.current.scrollToTop()
}
}, [JSON.stringify(relayUrls)])
if (!relayUrls.length) { if (!relayUrls.length) {
return ( return (
<PrimaryPageLayout> <PrimaryPageLayout>
@ -33,7 +41,7 @@ export default function NoteListPage() {
} }
return ( return (
<PrimaryPageLayout> <PrimaryPageLayout ref={layoutRef}>
<NoteList relayUrls={relayUrls} /> <NoteList relayUrls={relayUrls} />
</PrimaryPageLayout> </PrimaryPageLayout>
) )

Loading…
Cancel
Save