Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| ea3b353127 | |||
| 53e62cee80 |
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "lume",
|
"name": "lume",
|
||||||
"private": true,
|
"private": true,
|
||||||
"version": "3.0.1",
|
"version": "3.0.2",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "turbo build",
|
"build": "turbo build",
|
||||||
"dev": "turbo dev",
|
"dev": "turbo dev",
|
||||||
|
|||||||
@@ -4,12 +4,21 @@ import * as Tooltip from "@radix-ui/react-tooltip";
|
|||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
import { useColumnContext } from "../../column/provider";
|
import { useColumnContext } from "../../column/provider";
|
||||||
import { useNoteContext } from "../provider";
|
import { useNoteContext } from "../provider";
|
||||||
|
import { toast } from "sonner";
|
||||||
|
|
||||||
export function NotePin() {
|
export function NotePin() {
|
||||||
const event = useNoteContext();
|
|
||||||
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
const { addColumn } = useColumnContext();
|
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 (
|
return (
|
||||||
<Tooltip.Provider>
|
<Tooltip.Provider>
|
||||||
@@ -17,13 +26,7 @@ export function NotePin() {
|
|||||||
<Tooltip.Trigger asChild>
|
<Tooltip.Trigger asChild>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
onClick={async () =>
|
onClick={() => pin()}
|
||||||
await addColumn({
|
|
||||||
kind: COL_TYPES.thread,
|
|
||||||
title: "Thread",
|
|
||||||
content: event.id,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
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"
|
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" />
|
<PinIcon className="size-4" />
|
||||||
|
|||||||
@@ -3,8 +3,10 @@ import { downloadDir } from "@tauri-apps/api/path";
|
|||||||
import { Window } from "@tauri-apps/api/window";
|
import { Window } from "@tauri-apps/api/window";
|
||||||
import { download } from "@tauri-apps/plugin-upload";
|
import { download } from "@tauri-apps/plugin-upload";
|
||||||
import { SyntheticEvent, useState } from "react";
|
import { SyntheticEvent, useState } from "react";
|
||||||
|
import { useNoteContext } from "../provider";
|
||||||
|
|
||||||
export function ImagePreview({ url }: { url: string }) {
|
export function ImagePreview({ url }: { url: string }) {
|
||||||
|
const event = useNoteContext();
|
||||||
const [downloaded, setDownloaded] = useState(false);
|
const [downloaded, setDownloaded] = useState(false);
|
||||||
|
|
||||||
const downloadImage = async (e: { stopPropagation: () => void }) => {
|
const downloadImage = async (e: { stopPropagation: () => void }) => {
|
||||||
@@ -22,10 +24,9 @@ export function ImagePreview({ url }: { url: string }) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const open = async () => {
|
const open = async () => {
|
||||||
const name = new URL(url).pathname.split("/").pop();
|
return new Window(`image-viewer-${event.id}`, {
|
||||||
return new Window("image-viewer", {
|
|
||||||
url,
|
url,
|
||||||
title: name,
|
title: "Image Viewer",
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -3,12 +3,16 @@ import { useEvent } from "../../../hooks/useEvent";
|
|||||||
import { User } from "../../user";
|
import { User } from "../../user";
|
||||||
|
|
||||||
export function ThreadNote({ eventId }: { eventId: string }) {
|
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>;
|
return <div>Loading...</div>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isError) {
|
||||||
|
return <div>Error</div>;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Note.Provider event={data}>
|
<Note.Provider event={data}>
|
||||||
<Note.Root className="flex flex-col rounded-xl bg-neutral-50 dark:bg-neutral-950">
|
<Note.Root className="flex flex-col rounded-xl bg-neutral-50 dark:bg-neutral-950">
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
},
|
},
|
||||||
"package": {
|
"package": {
|
||||||
"productName": "Lume",
|
"productName": "Lume",
|
||||||
"version": "3.0.1"
|
"version": "3.0.2"
|
||||||
},
|
},
|
||||||
"plugins": {
|
"plugins": {
|
||||||
"fs": {
|
"fs": {
|
||||||
|
|||||||
Reference in New Issue
Block a user