feat: use latest nostr sdk

This commit is contained in:
2024-10-23 10:16:56 +07:00
parent cc7de41bfd
commit 172566028b
21 changed files with 596 additions and 240 deletions

View File

@@ -464,7 +464,7 @@ async updateColumn(label: string, width: number, height: number, x: number, y: n
else return { status: "error", error: e as any };
}
},
async reloadColumn(label: string) : Promise<Result<boolean, string>> {
async reloadColumn(label: string) : Promise<Result<null, string>> {
try {
return { status: "ok", data: await TAURI_INVOKE("reload_column", { label }) };
} catch (e) {

View File

@@ -74,6 +74,7 @@ export function Column({ column }: { column: LumeColumn }) {
<div className="flex flex-col gap-px size-full">
<Header
label={column.label}
webviewLabel={webviewLabel}
name={column.name}
account={column.account}
/>
@@ -85,9 +86,10 @@ export function Column({ column }: { column: LumeColumn }) {
function Header({
label,
webviewLabel,
name,
account,
}: { label: string; name: string; account?: string }) {
}: { label: string; webviewLabel: string; name: string; account?: string }) {
const [title, setTitle] = useState("");
const [isChanged, setIsChanged] = useState(false);
@@ -100,7 +102,7 @@ function Header({
MenuItem.new({
text: "Reload",
action: async () => {
await commands.reloadColumn(label);
await commands.reloadColumn(webviewLabel);
},
}),
PredefinedMenuItem.new({ item: "Separator" }),

View File

@@ -137,6 +137,13 @@ function Account({ pubkey }: { pubkey: string }) {
e.preventDefault();
const items = await Promise.all([
MenuItem.new({
text: "Unlock",
enabled: !isActive || true,
action: () =>
LumeWindow.openPopup(`/set-signer/${pubkey}`, undefined, false),
}),
PredefinedMenuItem.new({ item: "Separator" }),
MenuItem.new({
text: "View Profile",
action: () => LumeWindow.openProfile(pubkey),

View File

@@ -26,6 +26,7 @@ export const Route = createLazyFileRoute("/_layout/")({
});
function Screen() {
const { accounts } = Route.useRouteContext();
const columns = useStore(appColumns, (state) => state);
const [emblaRef, emblaApi] = useEmblaCarousel({
@@ -161,7 +162,10 @@ function Screen() {
getSystemColumns();
} else {
const parsed: LumeColumn[] = JSON.parse(prevColumns);
appColumns.setState(() => parsed);
const fil = parsed.filter((item) =>
item.account ? accounts.includes(item.account) : item,
);
appColumns.setState(() => fil);
}
} else {
window.localStorage.setItem("columns", JSON.stringify(columns));

View File

@@ -197,6 +197,10 @@ function Screen() {
};
const submit = async () => {
if (!text.length) {
return;
}
if (currentUser) {
const signer = await commands.hasSigner(currentUser);

View File

@@ -174,8 +174,8 @@ export const LumeWindow = {
label: `popup-${nanoid()}`,
url,
title: title ?? "",
width: 400,
height: 500,
width: 360,
height: 460,
maximizable: false,
minimizable: false,
hidden_title: !!title,