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,
|
"decorations": true,
|
||||||
"transparent": true,
|
"transparent": true,
|
||||||
"windowEffects": {
|
"windowEffects": {
|
||||||
"effects": ["hudWindow"]
|
"effects": ["sidebar"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -7,17 +7,13 @@ import { twMerge } from 'tailwind-merge';
|
|||||||
|
|
||||||
import { useDecryptMessage } from '@app/chats/hooks/useDecryptMessage';
|
import { useDecryptMessage } from '@app/chats/hooks/useDecryptMessage';
|
||||||
|
|
||||||
import { useStorage } from '@libs/storage/provider';
|
|
||||||
|
|
||||||
import { formatCreatedAt } from '@utils/createdAt';
|
import { formatCreatedAt } from '@utils/createdAt';
|
||||||
import { useProfile } from '@utils/hooks/useProfile';
|
import { useProfile } from '@utils/hooks/useProfile';
|
||||||
import { displayNpub } from '@utils/shortenKey';
|
import { displayNpub } from '@utils/shortenKey';
|
||||||
|
|
||||||
export const ChatListItem = memo(function ChatListItem({ event }: { event: NDKEvent }) {
|
export const ChatListItem = memo(function ChatListItem({ event }: { event: NDKEvent }) {
|
||||||
const { db } = useStorage();
|
|
||||||
const { status, user } = useProfile(event.pubkey);
|
const { status, user } = useProfile(event.pubkey);
|
||||||
|
const decryptedContent = useDecryptMessage(event);
|
||||||
const decryptedContent = useDecryptMessage(event, db.account.pubkey);
|
|
||||||
|
|
||||||
const createdAt = formatCreatedAt(event.created_at, true);
|
const createdAt = formatCreatedAt(event.created_at, true);
|
||||||
const svgURI =
|
const svgURI =
|
||||||
|
@ -2,14 +2,18 @@ import { NDKEvent } from '@nostr-dev-kit/ndk';
|
|||||||
import { nip04 } from 'nostr-tools';
|
import { nip04 } from 'nostr-tools';
|
||||||
import { useEffect, useState } from 'react';
|
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);
|
const [content, setContent] = useState(message.content);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
async function decryptContent() {
|
async function decryptContent() {
|
||||||
try {
|
try {
|
||||||
|
const privkey = await db.secureLoad();
|
||||||
const sender =
|
const sender =
|
||||||
pubkey === message.pubkey
|
db.account.pubkey === message.pubkey
|
||||||
? message.tags.find((el) => el[0] === 'p')[1]
|
? message.tags.find((el) => el[0] === 'p')[1]
|
||||||
: message.pubkey;
|
: message.pubkey;
|
||||||
const result = await nip04.decrypt(privkey, sender, message.content);
|
const result = await nip04.decrypt(privkey, sender, message.content);
|
||||||
|
@ -28,7 +28,7 @@ const NDKProvider = ({ children }: PropsWithChildren<object>) => {
|
|||||||
data-tauri-drag-region
|
data-tauri-drag-region
|
||||||
className="flex h-screen w-screen items-center justify-center bg-neutral-50 dark:bg-neutral-950"
|
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" />
|
<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">
|
<h3 className="text-lg font-medium leading-none text-neutral-950 dark:text-neutral-50">
|
||||||
Connecting...
|
Connecting...
|
||||||
|
@ -10,7 +10,12 @@ export function AppLayout() {
|
|||||||
const { db } = useStorage();
|
const { db } = useStorage();
|
||||||
|
|
||||||
return (
|
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' ? (
|
{db.platform !== 'macos' ? (
|
||||||
<WindowTitlebar />
|
<WindowTitlebar />
|
||||||
) : (
|
) : (
|
||||||
|
Loading…
Reference in New Issue
Block a user