mirror of
https://github.com/luminous-devs/lume.git
synced 2024-09-18 11:13:30 +00:00
wip: fix ui for macos
This commit is contained in:
parent
893663561d
commit
0777c483e5
@ -17,7 +17,7 @@
|
||||
"decorations": true,
|
||||
"transparent": true,
|
||||
"windowEffects": {
|
||||
"effects": ["hudWindow"]
|
||||
"effects": ["sidebar"]
|
||||
}
|
||||
}
|
||||
]
|
||||
|
@ -7,17 +7,13 @@ import { twMerge } from 'tailwind-merge';
|
||||
|
||||
import { useDecryptMessage } from '@app/chats/hooks/useDecryptMessage';
|
||||
|
||||
import { useStorage } from '@libs/storage/provider';
|
||||
|
||||
import { formatCreatedAt } from '@utils/createdAt';
|
||||
import { useProfile } from '@utils/hooks/useProfile';
|
||||
import { displayNpub } from '@utils/shortenKey';
|
||||
|
||||
export const ChatListItem = memo(function ChatListItem({ event }: { event: NDKEvent }) {
|
||||
const { db } = useStorage();
|
||||
const { status, user } = useProfile(event.pubkey);
|
||||
|
||||
const decryptedContent = useDecryptMessage(event, db.account.pubkey);
|
||||
const decryptedContent = useDecryptMessage(event);
|
||||
|
||||
const createdAt = formatCreatedAt(event.created_at, true);
|
||||
const svgURI =
|
||||
|
@ -2,14 +2,18 @@ import { NDKEvent } from '@nostr-dev-kit/ndk';
|
||||
import { nip04 } from 'nostr-tools';
|
||||
import { useEffect, useState } from 'react';
|
||||
|
||||
export function useDecryptMessage(message: NDKEvent, pubkey: string, privkey: string) {
|
||||
import { useStorage } from '@libs/storage/provider';
|
||||
|
||||
export function useDecryptMessage(message: NDKEvent) {
|
||||
const { db } = useStorage();
|
||||
const [content, setContent] = useState(message.content);
|
||||
|
||||
useEffect(() => {
|
||||
async function decryptContent() {
|
||||
try {
|
||||
const privkey = await db.secureLoad();
|
||||
const sender =
|
||||
pubkey === message.pubkey
|
||||
db.account.pubkey === message.pubkey
|
||||
? message.tags.find((el) => el[0] === 'p')[1]
|
||||
: message.pubkey;
|
||||
const result = await nip04.decrypt(privkey, sender, message.content);
|
||||
|
@ -28,7 +28,7 @@ const NDKProvider = ({ children }: PropsWithChildren<object>) => {
|
||||
data-tauri-drag-region
|
||||
className="flex h-screen w-screen items-center justify-center bg-neutral-50 dark:bg-neutral-950"
|
||||
>
|
||||
<div className="flex flex-col items-center justify-center gap-6">
|
||||
<div className="flex flex-col items-center justify-center gap-2">
|
||||
<LoaderIcon className="h-6 w-6 animate-spin text-neutral-950 dark:text-neutral-50" />
|
||||
<h3 className="text-lg font-medium leading-none text-neutral-950 dark:text-neutral-50">
|
||||
Connecting...
|
||||
|
@ -10,7 +10,12 @@ export function AppLayout() {
|
||||
const { db } = useStorage();
|
||||
|
||||
return (
|
||||
<div className="flex h-screen w-screen flex-col bg-neutral-50 dark:bg-neutral-950">
|
||||
<div
|
||||
className={twMerge(
|
||||
'flex h-screen w-screen flex-col',
|
||||
db.platform !== 'macos' ? 'bg-neutral-50 dark:bg-neutral-950' : ''
|
||||
)}
|
||||
>
|
||||
{db.platform !== 'macos' ? (
|
||||
<WindowTitlebar />
|
||||
) : (
|
||||
|
Loading…
Reference in New Issue
Block a user