small fixes

This commit is contained in:
Ren Amamiya 2023-09-07 12:19:28 +07:00
parent 8eb11efb34
commit 472925bb05
3 changed files with 20 additions and 20 deletions

View File

@ -4,6 +4,8 @@ import { twMerge } from 'tailwind-merge';
import { ChatsList } from '@app/chats/components/list'; import { ChatsList } from '@app/chats/components/list';
import { useStorage } from '@libs/storage/provider';
import { ActiveAccount } from '@shared/accounts/active'; import { ActiveAccount } from '@shared/accounts/active';
import { ComposerModal } from '@shared/composer'; import { ComposerModal } from '@shared/composer';
import { Frame } from '@shared/frame'; import { Frame } from '@shared/frame';
@ -12,11 +14,14 @@ import { BellIcon, NavArrowDownIcon, SpaceIcon } from '@shared/icons';
import { useSidebar } from '@stores/sidebar'; import { useSidebar } from '@stores/sidebar';
export function Navigation() { export function Navigation() {
const { db } = useStorage();
const [chats, toggleChats] = useSidebar((state) => [state.chats, state.toggleChats]); const [chats, toggleChats] = useSidebar((state) => [state.chats, state.toggleChats]);
return ( return (
<Frame className="relative flex h-full w-[232px] flex-col" lighter> <Frame className="relative flex h-full w-[232px] flex-col" lighter>
<div data-tauri-drag-region className="h-11 w-full shrink-0" /> {db.platform === 'darwin' ? (
<div data-tauri-drag-region className="h-11 w-full shrink-0" />
) : null}
<div className="scrollbar-hide flex h-full flex-1 flex-col gap-6 overflow-y-auto pb-32"> <div className="scrollbar-hide flex h-full flex-1 flex-col gap-6 overflow-y-auto pb-32">
<div className="flex flex-col pr-2"> <div className="flex flex-col pr-2">
<ComposerModal /> <ComposerModal />

View File

@ -58,29 +58,24 @@ export const MentionNote = memo(function MentionNote({ id }: { id: string }) {
if (status === 'error') { if (status === 'error') {
const noteLink = `https://nostr.com/${nip19.noteEncode(id)}`; const noteLink = `https://nostr.com/${nip19.noteEncode(id)}`;
return ( return (
<div className="relative mb-5 flex flex-col"> <div className="relative mt-3 flex flex-col">
<div className="relative z-10 flex items-start gap-3"> <div className="relative z-10 flex items-center gap-3">
<div className="inline-flex h-11 w-11 items-end justify-center rounded-lg bg-black pb-1"> <div className="inline-flex h-6 w-6 items-end justify-center rounded bg-black pb-1">
<img src="/lume.png" alt="lume" className="h-auto w-1/3" /> <img src="/lume.png" alt="lume" className="h-auto w-1/3" />
</div> </div>
<h5 className="truncate font-semibold leading-none text-white"> <h5 className="truncate font-semibold leading-none text-white">
Lume <span className="text-green-500">(System)</span> Lume <span className="text-green-500">(System)</span>
</h5> </h5>
</div> </div>
<div className="-mt-6 flex items-start gap-3"> <div className="mt-1">
<div className="w-11 shrink-0" /> <div className="mb-1 select-text rounded-lg bg-white/5 p-1.5 text-sm">
<div> Lume cannot find this post with your current relays, but you can view it via
<div className="relative z-20 mt-1 flex-1 select-text"> nostr.com.{' '}
<div className="mb-1 select-text rounded-lg bg-white/5 p-1.5 text-sm"> <Link to={noteLink} className="text-fuchsia-500">
Lume cannot find this post with your current relays, but you can view it Learn more
via nostr.com.{' '} </Link>
<Link to={noteLink} className="text-fuchsia-500">
Learn more
</Link>
</div>
</div>
<LinkPreview urls={[noteLink]} />
</div> </div>
<LinkPreview urls={[noteLink]} />
</div> </div>
</div> </div>
); );

View File

@ -32,18 +32,18 @@ export function parser(eventContent: string) {
const url = new URL(word); const url = new URL(word);
url.search = ''; url.search = '';
if (url.toString().match(/\.(jpg|jpeg|gif|png|webp|avif)$/)) { if (url.pathname.match(/\.(jpg|jpeg|gif|png|webp|avif)$/)) {
// image url // image url
content.images.push(word); content.images.push(word);
// remove url from original content // remove url from original content
return word.replace(word, ''); return word.replace(word, '');
} }
if (url.toString().match(/\.(mp4|mov|webm|wmv|flv|mts|avi|ogv|mkv|mp3|m3u8)$/)) { if (url.pathname.match(/\.(mp4|mov|webm|wmv|flv|mts|avi|ogv|mkv|mp3|m3u8)$/)) {
// video // video
content.videos.push(word); content.videos.push(word);
// remove url from original content // remove url from original content
word = word.replace(word, ''); return word.replace(word, '');
} }
content.links.push(url.toString()); content.links.push(url.toString());