Compare commits

...

2 Commits

Author SHA1 Message Date
ea3b353127 chore: bump version 2024-04-17 07:31:32 +07:00
53e62cee80 fix: prevent app crash in some cases 2024-04-17 07:30:52 +07:00
5 changed files with 277 additions and 269 deletions

View File

@@ -1,7 +1,7 @@
{
"name": "lume",
"private": true,
"version": "3.0.1",
"version": "3.0.2",
"scripts": {
"build": "turbo build",
"dev": "turbo dev",

View File

@@ -4,12 +4,21 @@ import * as Tooltip from "@radix-ui/react-tooltip";
import { useTranslation } from "react-i18next";
import { useColumnContext } from "../../column/provider";
import { useNoteContext } from "../provider";
import { toast } from "sonner";
export function NotePin() {
const event = useNoteContext();
const { t } = useTranslation();
const { addColumn } = useColumnContext();
const event = useNoteContext();
const pin = async () => {
if (!event) toast.error("Something is wrong!");
await addColumn({
kind: COL_TYPES.thread,
title: "Thread",
content: event?.id,
});
};
return (
<Tooltip.Provider>
@@ -17,13 +26,7 @@ export function NotePin() {
<Tooltip.Trigger asChild>
<button
type="button"
onClick={async () =>
await addColumn({
kind: COL_TYPES.thread,
title: "Thread",
content: event.id,
})
}
onClick={() => pin()}
className="inline-flex items-center justify-center gap-2 pl-2 pr-3 text-sm font-medium rounded-full h-7 w-max bg-neutral-100 hover:bg-neutral-200 dark:hover:bg-neutral-800 dark:bg-neutral-900"
>
<PinIcon className="size-4" />

View File

@@ -3,8 +3,10 @@ import { downloadDir } from "@tauri-apps/api/path";
import { Window } from "@tauri-apps/api/window";
import { download } from "@tauri-apps/plugin-upload";
import { SyntheticEvent, useState } from "react";
import { useNoteContext } from "../provider";
export function ImagePreview({ url }: { url: string }) {
const event = useNoteContext();
const [downloaded, setDownloaded] = useState(false);
const downloadImage = async (e: { stopPropagation: () => void }) => {
@@ -22,10 +24,9 @@ export function ImagePreview({ url }: { url: string }) {
};
const open = async () => {
const name = new URL(url).pathname.split("/").pop();
return new Window("image-viewer", {
return new Window(`image-viewer-${event.id}`, {
url,
title: name,
title: "Image Viewer",
});
};

View File

@@ -3,12 +3,16 @@ import { useEvent } from "../../../hooks/useEvent";
import { User } from "../../user";
export function ThreadNote({ eventId }: { eventId: string }) {
const { isLoading, data } = useEvent(eventId);
const { isLoading, isError, data } = useEvent(eventId);
if (isLoading) {
if (isLoading || !data) {
return <div>Loading...</div>;
}
if (isError) {
return <div>Error</div>;
}
return (
<Note.Provider event={data}>
<Note.Root className="flex flex-col rounded-xl bg-neutral-50 dark:bg-neutral-950">

View File

@@ -9,7 +9,7 @@
},
"package": {
"productName": "Lume",
"version": "3.0.1"
"version": "3.0.2"
},
"plugins": {
"fs": {