mirror of
https://github.com/luminous-devs/lume.git
synced 2024-09-19 11:43:30 +00:00
replace nostr.com with njump.me
This commit is contained in:
parent
1206486016
commit
8726e22b38
@ -89,7 +89,7 @@ export function UnlockScreen() {
|
|||||||
{...register('password', { required: true, minLength: 4 })}
|
{...register('password', { required: true, minLength: 4 })}
|
||||||
type={showPassword ? 'text' : 'password'}
|
type={showPassword ? 'text' : 'password'}
|
||||||
placeholder="Password"
|
placeholder="Password"
|
||||||
className="relative h-12 w-full rounded-b-lg bg-white/10 py-1 text-center tracking-widest text-white !outline-none backdrop-blur-xl placeholder:text-white/50"
|
className="relative h-12 w-full rounded-b-lg bg-white/10 py-1 text-center tracking-widest text-white !outline-none backdrop-blur-xl placeholder:tracking-normal placeholder:text-white/50"
|
||||||
/>
|
/>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
|
@ -35,7 +35,7 @@ export function ArticleNoteScreen() {
|
|||||||
|
|
||||||
const share = async () => {
|
const share = async () => {
|
||||||
await writeText(
|
await writeText(
|
||||||
'https://nostr.com/' +
|
'https://njump.me/' +
|
||||||
nip19.neventEncode({ id: data.id, author: data.pubkey } as EventPointer)
|
nip19.neventEncode({ id: data.id, author: data.pubkey } as EventPointer)
|
||||||
);
|
);
|
||||||
// update state
|
// update state
|
||||||
|
@ -35,7 +35,7 @@ export function TextNoteScreen() {
|
|||||||
|
|
||||||
const share = async () => {
|
const share = async () => {
|
||||||
await writeText(
|
await writeText(
|
||||||
'https://nostr.com/' +
|
'https://njump.me/' +
|
||||||
nip19.neventEncode({ id: data.id, author: data.pubkey } as EventPointer)
|
nip19.neventEncode({ id: data.id, author: data.pubkey } as EventPointer)
|
||||||
);
|
);
|
||||||
// update state
|
// update state
|
||||||
|
@ -18,8 +18,7 @@ export function MoreActions({ id, pubkey }: { id: string; pubkey: string }) {
|
|||||||
|
|
||||||
const copyLink = async () => {
|
const copyLink = async () => {
|
||||||
await writeText(
|
await writeText(
|
||||||
'https://nostr.com/' +
|
'https://njump.me/' + nip19.neventEncode({ id: id, author: pubkey } as EventPointer)
|
||||||
nip19.neventEncode({ id: id, author: pubkey } as EventPointer)
|
|
||||||
);
|
);
|
||||||
setOpen(false);
|
setOpen(false);
|
||||||
};
|
};
|
||||||
|
@ -43,7 +43,7 @@ export function ChildNote({ id, root }: { id: string; root?: string }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (status === 'error') {
|
if (status === 'error') {
|
||||||
const noteLink = `https://nostr.com/${nip19.noteEncode(id)}`;
|
const noteLink = `https://njump.me/${nip19.noteEncode(id)}`;
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<div className="absolute bottom-0 left-[18px] h-[calc(100%-3.4rem)] w-0.5 bg-gradient-to-t from-white/20 to-white/10" />
|
<div className="absolute bottom-0 left-[18px] h-[calc(100%-3.4rem)] w-0.5 bg-gradient-to-t from-white/20 to-white/10" />
|
||||||
@ -62,7 +62,7 @@ export function ChildNote({ id, root }: { id: string; root?: string }) {
|
|||||||
<div className="relative z-20 mt-1 flex-1 select-text">
|
<div className="relative z-20 mt-1 flex-1 select-text">
|
||||||
<div className="mb-1 select-text rounded-lg bg-white/5 p-1.5 text-sm">
|
<div className="mb-1 select-text rounded-lg bg-white/5 p-1.5 text-sm">
|
||||||
Lume cannot find this post with your current relays, but you can view it
|
Lume cannot find this post with your current relays, but you can view it
|
||||||
via nostr.com.{' '}
|
via njump.me.{' '}
|
||||||
<Link to={noteLink} className="text-fuchsia-500">
|
<Link to={noteLink} className="text-fuchsia-500">
|
||||||
Learn more
|
Learn more
|
||||||
</Link>
|
</Link>
|
||||||
|
@ -19,7 +19,7 @@ import { useEvent } from '@utils/hooks/useEvent';
|
|||||||
|
|
||||||
export function Repost({ event, root }: { event: NDKEvent; root?: string }) {
|
export function Repost({ event, root }: { event: NDKEvent; root?: string }) {
|
||||||
const rootPost = root ?? event.tags.find((el) => el[0] === 'e')?.[1];
|
const rootPost = root ?? event.tags.find((el) => el[0] === 'e')?.[1];
|
||||||
const { status, data } = useEvent(rootPost, event.content);
|
const { status, data } = useEvent(rootPost, null, event.content);
|
||||||
|
|
||||||
const renderKind = useCallback(
|
const renderKind = useCallback(
|
||||||
(repostEvent: NDKEvent) => {
|
(repostEvent: NDKEvent) => {
|
||||||
@ -49,7 +49,7 @@ export function Repost({ event, root }: { event: NDKEvent; root?: string }) {
|
|||||||
|
|
||||||
if (status === 'error') {
|
if (status === 'error') {
|
||||||
// @ts-expect-error, root_id isn't exist on NDKEvent
|
// @ts-expect-error, root_id isn't exist on NDKEvent
|
||||||
const noteLink = `https://nostr.com/${nip19.noteEncode(event.root_id)}`;
|
const noteLink = `https://njump.me/${nip19.noteEncode(event.root_id)}`;
|
||||||
return (
|
return (
|
||||||
<div className="relative mb-5 flex flex-col">
|
<div className="relative mb-5 flex flex-col">
|
||||||
<div className="relative z-10 flex items-start gap-3">
|
<div className="relative z-10 flex items-start gap-3">
|
||||||
@ -66,7 +66,7 @@ export function Repost({ event, root }: { event: NDKEvent; root?: string }) {
|
|||||||
<div className="relative z-20 mt-1 flex-1 select-text">
|
<div className="relative z-20 mt-1 flex-1 select-text">
|
||||||
<div className="mb-1 select-text rounded-lg bg-white/5 p-1.5 text-sm">
|
<div className="mb-1 select-text rounded-lg bg-white/5 p-1.5 text-sm">
|
||||||
Lume cannot find this post with your current relays, but you can view it
|
Lume cannot find this post with your current relays, but you can view it
|
||||||
via nostr.com.{' '}
|
via njump.me.{' '}
|
||||||
<Link to={noteLink} className="text-fuchsia-500">
|
<Link to={noteLink} className="text-fuchsia-500">
|
||||||
Learn more
|
Learn more
|
||||||
</Link>
|
</Link>
|
||||||
|
@ -56,7 +56,7 @@ 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://njump.me/${nip19.noteEncode(id)}`;
|
||||||
return (
|
return (
|
||||||
<div className="relative mt-3 flex flex-col">
|
<div className="relative mt-3 flex flex-col">
|
||||||
<div className="relative z-10 flex items-center gap-3">
|
<div className="relative z-10 flex items-center gap-3">
|
||||||
@ -70,7 +70,7 @@ export const MentionNote = memo(function MentionNote({ id }: { id: string }) {
|
|||||||
<div className="mt-1">
|
<div className="mt-1">
|
||||||
<div className="mb-1 select-text rounded-lg bg-white/5 p-1.5 text-sm">
|
<div className="mb-1 select-text rounded-lg bg-white/5 p-1.5 text-sm">
|
||||||
Lume cannot find this post with your current relays, but you can view it via
|
Lume cannot find this post with your current relays, but you can view it via
|
||||||
nostr.com.{' '}
|
njump.me.{' '}
|
||||||
<Link to={noteLink} className="text-fuchsia-500">
|
<Link to={noteLink} className="text-fuchsia-500">
|
||||||
Learn more
|
Learn more
|
||||||
</Link>
|
</Link>
|
||||||
|
@ -9,13 +9,14 @@ import { Widget } from '@utils/types';
|
|||||||
|
|
||||||
export function LearnNostrWidget({ params }: { params: Widget }) {
|
export function LearnNostrWidget({ params }: { params: Widget }) {
|
||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
const readResource = useResources((state) => state.readResource);
|
const openResource = useResources((state) => state.openResource);
|
||||||
|
|
||||||
const resources = useResources((state) => state.resources);
|
const resources = useResources((state) => state.resources);
|
||||||
const readed = useResources((state) => state.readed);
|
const seens = useResources((state) => state.seens);
|
||||||
|
|
||||||
const open = (naddr: string) => {
|
const open = (naddr: string) => {
|
||||||
readResource(naddr);
|
// add resource to seen list
|
||||||
|
openResource(naddr);
|
||||||
|
// redirect
|
||||||
navigate(`/notes/article/${naddr}`);
|
navigate(`/notes/article/${naddr}`);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -39,7 +40,7 @@ export function LearnNostrWidget({ params }: { params: Widget }) {
|
|||||||
<div className="h-10 w-10 shrink-0 rounded-md bg-white/10" />
|
<div className="h-10 w-10 shrink-0 rounded-md bg-white/10" />
|
||||||
<div className="flex flex-col items-start gap-1">
|
<div className="flex flex-col items-start gap-1">
|
||||||
<h5 className="font-semibold leading-none">{item.title}</h5>
|
<h5 className="font-semibold leading-none">{item.title}</h5>
|
||||||
{readed.has(item.id) ? (
|
{seens.has(item.id) ? (
|
||||||
<p className="text-sm leading-none text-green-500">Readed</p>
|
<p className="text-sm leading-none text-green-500">Readed</p>
|
||||||
) : (
|
) : (
|
||||||
<p className="text-sm leading-none text-white/70">Unread</p>
|
<p className="text-sm leading-none text-white/70">Unread</p>
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import { create } from 'zustand';
|
import { create } from 'zustand';
|
||||||
import { createJSONStorage, persist } from 'zustand/middleware';
|
import { persist } from 'zustand/middleware';
|
||||||
|
|
||||||
import { Resources } from '@utils/types';
|
import { Resources } from '@utils/types';
|
||||||
|
|
||||||
@ -47,22 +47,42 @@ const DEFAULT_RESOURCES: Array<Resources> = [
|
|||||||
|
|
||||||
interface ResourceState {
|
interface ResourceState {
|
||||||
resources: Array<Resources>;
|
resources: Array<Resources>;
|
||||||
readed: Set<string>;
|
seens: Set<string>;
|
||||||
readResource: (id: string) => void;
|
openResource: (id: string) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const useResources = create<ResourceState>()(
|
export const useResources = create<ResourceState>()(
|
||||||
persist(
|
persist(
|
||||||
(set) => ({
|
(set) => ({
|
||||||
resources: DEFAULT_RESOURCES,
|
resources: DEFAULT_RESOURCES,
|
||||||
readed: new Set(),
|
seens: new Set(),
|
||||||
readResource: (id: string) => {
|
openResource: (id: string) => {
|
||||||
set((state) => ({ readed: new Set(state.readed).add(id) }));
|
set((state) => ({ seens: new Set(state.seens).add(id) }));
|
||||||
},
|
},
|
||||||
}),
|
}),
|
||||||
{
|
{
|
||||||
name: 'resources',
|
name: 'resources',
|
||||||
storage: createJSONStorage(() => localStorage),
|
storage: {
|
||||||
|
getItem: (name) => {
|
||||||
|
const str = localStorage.getItem(name);
|
||||||
|
return {
|
||||||
|
state: {
|
||||||
|
...JSON.parse(str).state,
|
||||||
|
seens: new Set(JSON.parse(str).state.seens),
|
||||||
|
},
|
||||||
|
};
|
||||||
|
},
|
||||||
|
setItem: (name, newValue) => {
|
||||||
|
const str = JSON.stringify({
|
||||||
|
state: {
|
||||||
|
...newValue.state,
|
||||||
|
seens: Array.from(newValue.state.seens),
|
||||||
|
},
|
||||||
|
});
|
||||||
|
localStorage.setItem(name, str);
|
||||||
|
},
|
||||||
|
removeItem: (name) => localStorage.removeItem(name),
|
||||||
|
},
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
Loading…
Reference in New Issue
Block a user