small fixes and support $ boost sign

This commit is contained in:
Ren Amamiya 2023-09-28 07:29:05 +07:00
parent 7cef6efa6f
commit c80414a72d
8 changed files with 31 additions and 38 deletions

View File

@ -16,7 +16,7 @@ tauri-build = { version = "1.4", features = [] }
[dependencies]
serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] }
tauri = { version = "1.4", features = [
tauri = { version = "1.4", features = [ "macos-private-api",
"window-close",
"window-print",
"window-create",

View File

@ -80,8 +80,8 @@ export function ImportStep3Screen() {
)}
</button>
<span className="text-center text-sm text-white/50">
By clicking &apos;Continue&apos;, Lume will sync your old relay list and
metadata.<br/>It may take a bit, please be patient.
By clicking &apos;Continue&apos;, Lume will download your old relay list and
metadata. It may take a bit
</span>
</div>
</div>

View File

@ -1,34 +1,10 @@
import { LogicalSize, getCurrent } from '@tauri-apps/api/window';
import { useEffect } from 'react';
import { Link } from 'react-router-dom';
import { ArrowRightCircleIcon } from '@shared/icons/arrowRightCircle';
export function WelcomeScreen() {
const appWindow = getCurrent();
async function setWindow() {
await appWindow.setSize(new LogicalSize(400, 500));
await appWindow.setResizable(false);
await appWindow.center();
}
async function resetWindow() {
await appWindow.setSize(new LogicalSize(1080, 800));
await appWindow.setResizable(true);
await appWindow.center();
}
useEffect(() => {
setWindow();
return () => {
resetWindow();
};
}, []);
return (
<div className="flex h-screen w-full flex-col justify-between">
<div className="mx-auto flex h-screen w-full max-w-md flex-col justify-center">
<div className="flex flex-col gap-10 pt-16">
<div className="flex flex-col gap-1.5 text-center">
<h1 className="text-3xl font-semibold text-white">Welcome to Lume</h1>
@ -54,8 +30,8 @@ export function WelcomeScreen() {
</Link>
</div>
</div>
<div className="flex flex-1 items-end justify-center pb-6">
<img src="/lume.png" alt="lume" className="h-auto w-1/4" />
<div className="absolute bottom-6 left-1/2 -translate-x-1/2 transform">
<img src="/lume.png" alt="lume" className="mx-auto h-auto w-1/4" />
</div>
</div>
);

View File

@ -22,5 +22,6 @@ export * from './child';
export * from './skeleton';
export * from './actions';
export * from './mentions/hashtag';
export * from './mentions/boost';
export * from './stats';
export * from './wrapper';

View File

@ -3,6 +3,7 @@ import { Link } from 'react-router-dom';
import remarkGfm from 'remark-gfm';
import {
Boost,
Hashtag,
ImagePreview,
LinkPreview,
@ -56,6 +57,9 @@ export function TextNote(props: { content?: string }) {
if (key.startsWith('tag')) {
return <Hashtag tag={key.replace('tag-', '')} />;
}
if (key.startsWith('boost')) {
return <Boost boost={key.replace('boost-', '')} />;
}
},
}}
disallowedElements={['h1', 'h2', 'h3', 'h4', 'h5', 'h6']}

View File

@ -0,0 +1,5 @@
export function Boost({ boost }: { boost: string }) {
return (
<span className="break-words text-fuchsia-400 hover:text-fuchsia-500">{boost}</span>
);
}

View File

@ -1,11 +1,12 @@
import { memo } from 'react';
import { useStorage } from '@libs/storage/provider';
import { WidgetKinds, useWidgets } from '@stores/widgets';
import { useProfile } from '@utils/hooks/useProfile';
import { displayNpub } from '@utils/shortenKey';
export function MentionUser({ pubkey }: { pubkey: string }) {
export const MentionUser = memo(function MentionUser({ pubkey }: { pubkey: string }) {
const { db } = useStorage();
const { user } = useProfile(pubkey);
@ -31,11 +32,12 @@ export function MentionUser({ pubkey }: { pubkey: string }) {
}
className="break-words text-fuchsia-400 hover:text-fuchsia-500"
>
{user?.name ||
user?.display_name ||
user?.displayName ||
user?.username ||
displayNpub(pubkey, 16)}
{'@' +
(user?.name ||
user?.display_name ||
user?.displayName ||
user?.username ||
'unknown')}
</span>
);
}
});

View File

@ -57,6 +57,11 @@ export function parser(eventContent: string) {
return word.replace(word, `~tag-${word}~`);
}
// boost
if (word.startsWith('$') && word.length > 1) {
return word.replace(word, `~boost-${word}~`);
}
// nostr account references
if (word.startsWith('nostr:npub1') || word.startsWith('npub1')) {
const npub = word.replace('nostr:', '').replace(/[^a-zA-Z0-9 ]/g, '');