feat: 💄 improve preview styling, allow document select in preview panel
This commit is contained in:
parent
fa3d55cd1b
commit
0e1bde62b7
@ -1,4 +1,4 @@
|
|||||||
.pdfPreview {
|
.pdfThumbnail {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ import {
|
|||||||
ActionIcon,
|
ActionIcon,
|
||||||
AppShell,
|
AppShell,
|
||||||
Autocomplete,
|
Autocomplete,
|
||||||
|
Box,
|
||||||
Burger,
|
Burger,
|
||||||
Button,
|
Button,
|
||||||
Group,
|
Group,
|
||||||
@ -131,10 +132,7 @@ function Organizrr() {
|
|||||||
const handleFileDrop = (files: FileWithPath[]) => {
|
const handleFileDrop = (files: FileWithPath[]) => {
|
||||||
if (files.length < 1) return;
|
if (files.length < 1) return;
|
||||||
|
|
||||||
if (engine.current) {
|
|
||||||
files.forEach((f) => {
|
files.forEach((f) => {
|
||||||
if (!engine.current) return;
|
|
||||||
|
|
||||||
const id = Math.random().toString(36).replace("0.", "doc_");
|
const id = Math.random().toString(36).replace("0.", "doc_");
|
||||||
const fileId = Math.random().toString(36).replace("0.", "file_");
|
const fileId = Math.random().toString(36).replace("0.", "file_");
|
||||||
|
|
||||||
@ -145,6 +143,7 @@ function Organizrr() {
|
|||||||
suffix: "",
|
suffix: "",
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (engine.current) {
|
||||||
const messages: ChatCompletionMessageParam[] = [
|
const messages: ChatCompletionMessageParam[] = [
|
||||||
systemMessage,
|
systemMessage,
|
||||||
{ role: "user", content: "The file name is: " + f.name },
|
{ role: "user", content: "The file name is: " + f.name },
|
||||||
@ -185,8 +184,8 @@ function Organizrr() {
|
|||||||
|
|
||||||
setGeneratingFilenames((fns) => fns.filter((fn) => fn !== fileId));
|
setGeneratingFilenames((fns) => fns.filter((fn) => fn !== fileId));
|
||||||
});
|
});
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
setActiveFile(form.getValues().files.length - 1);
|
setActiveFile(form.getValues().files.length - 1);
|
||||||
setActiveDocumentId(
|
setActiveDocumentId(
|
||||||
@ -461,7 +460,7 @@ function Organizrr() {
|
|||||||
(_d) => _d.id === d.id
|
(_d) => _d.id === d.id
|
||||||
)?.file
|
)?.file
|
||||||
}
|
}
|
||||||
className={classNames.pdfPreview}
|
className={classNames.pdfThumbnail}
|
||||||
>
|
>
|
||||||
<Page pageNumber={1} scale={0.5} />
|
<Page pageNumber={1} scale={0.5} />
|
||||||
</Document>
|
</Document>
|
||||||
@ -525,11 +524,19 @@ function Organizrr() {
|
|||||||
<Group style={{ alignSelf: "start" }}>
|
<Group style={{ alignSelf: "start" }}>
|
||||||
<IconEye /> <Title order={3}>Preview</Title>
|
<IconEye /> <Title order={3}>Preview</Title>
|
||||||
</Group>
|
</Group>
|
||||||
|
<Select
|
||||||
|
label="Select file"
|
||||||
|
data={form.values.documents.map(({ id, file }) => ({
|
||||||
|
value: id,
|
||||||
|
label: file.name,
|
||||||
|
}))}
|
||||||
|
value={activeDocumentId}
|
||||||
|
onChange={setActiveDocumentId}
|
||||||
|
/>
|
||||||
{activeDocument &&
|
{activeDocument &&
|
||||||
activeDocument.file.name.toLowerCase().endsWith(".pdf") && (
|
activeDocument.file.name.toLowerCase().endsWith(".pdf") && (
|
||||||
<>
|
<>
|
||||||
<Text>{activeDocument.file.name}</Text>
|
<ScrollArea maw="100%">
|
||||||
<ScrollArea w="100%">
|
|
||||||
<Document
|
<Document
|
||||||
file={activeDocument.file}
|
file={activeDocument.file}
|
||||||
onLoadSuccess={onDocumentLoadSuccess}
|
onLoadSuccess={onDocumentLoadSuccess}
|
||||||
|
Loading…
Reference in New Issue
Block a user