diff --git a/src/langs/json/en.json b/src/langs/json/en.json index 9adc41043..ff6681be9 100644 --- a/src/langs/json/en.json +++ b/src/langs/json/en.json @@ -252,7 +252,7 @@ "view": "Viewer" }, "delete": { - "action": "Delete project", + "action": "Delete Project", "confirm": "Confirm delete", "really": "Are you sure you want to delete this project ({project})?" }, @@ -263,7 +263,7 @@ "collaborators": { "title": "Collaborators", "empty": "No collaborators", - "add": "Invite users to this project" + "add": "Invite" }, "fields": { "title": "Title", @@ -350,15 +350,18 @@ "shareEmbed": "Share & Embed", "sharedWith": "Shared with", "revisions": "Revision History", - "edit": "Edit Metadata", + "edit": "Edit Document Metadata", "upload": "Upload Documents", "uploadToProject": "Upload to Project", "download": "Download File", "reprocess": "Reprocess", + "delete": "Delete", + "shareEmbedProject": "Share & Embed Project", + "editProject": "Edit Project Metadata", + "deleteProject": "Delete Project", "created": "Created on", "updated": "Last updated on", "language": "Language", - "delete": "Delete", "ocr_engine": "OCR Engine", "addons": { "title": "Add-Ons", @@ -387,7 +390,7 @@ "cta": "Annotate this document" }, "edit": { - "title": "Edit document metadata", + "title": "Edit Document Metadata", "fields": { "title": "Title", "description": "Description", @@ -422,10 +425,10 @@ } }, "redact": { + "title": "Redact Document", "confirm": "Save", "confirmTitle": "Save Redactions", "really": "Are you sure you wish to redact the current document? If you continue, the document viewer will be inaccessible temporarily while the document reprocesses with the redactions in place. This change is irreversible.", - "title": "Redact Document", "instructions": "Click and drag to draw a black rectangle over each portion of the document you’d like to redact. Associated text will be removed when you save your redactions.", "undo": "Undo", "cancel": "Discard", @@ -437,13 +440,13 @@ "page": "Page", "title": "Title", "delete": "Delete", - "new": "Add a new section", + "new": "Add New Section", "clear": "Clear", "update": "Update section", "overwrite": "There is already a section starting on page {n}." }, "delete": { - "title": "Confirm delete", + "title": "Confirm Delete", "really": "Proceeding will permanently delete the {n, plural, one {selected document} other {# selected documents}}.", "continue": "Do you wish to continue?", "confirm": "Delete", @@ -452,7 +455,7 @@ "none": "No documents selected. Close this form and select at least one document first." }, "data": { - "title": "Edit tags and data", + "title": "Edit Tags & Data", "key": "Key", "newkey": "New item", "value": "Value", @@ -462,15 +465,15 @@ "save": "Save", "cancel": "Cancel", "addNew": "Add new item:", - "many": "Saving will add the following data and tags to {n, plural, one {the selected document} other {all # selected documents}}. No tags or data will be removed." + "many": "Saving will add the following tags and data to {n, plural, one {the selected document} other {all # selected documents}}. No tags or data will be removed." }, "bulk": { - "title": "Edit", + "title": "Actions", "actions": { - "share": "Share", - "edit": "Edit metadata", - "data": "Edit tags & data", - "project": "Move to project", + "share": "Share & Embed", + "edit": "Edit Metadata", + "data": "Edit Tags & Data", + "project": "Move to Project", "reprocess": "Reprocess", "delete": "Delete" } diff --git a/src/lib/components/accounts/tests/__snapshots__/UserMenu.test.ts.snap b/src/lib/components/accounts/tests/__snapshots__/UserMenu.test.ts.snap index d6f245ae9..e3e6ba138 100644 --- a/src/lib/components/accounts/tests/__snapshots__/UserMenu.test.ts.snap +++ b/src/lib/components/accounts/tests/__snapshots__/UserMenu.test.ts.snap @@ -9,7 +9,7 @@ exports[`UserMenu 1`] = ` tabindex="0" > Account settings @@ -93,7 +93,7 @@ exports[`UserMenu 1`] = ` Upload via email @@ -121,7 +121,7 @@ exports[`UserMenu 1`] = ` @@ -139,7 +139,7 @@ exports[`UserMenu 1`] = ` Sign out diff --git a/src/lib/components/addons/tests/__snapshots__/AddOnsNavigation.test.ts.snap b/src/lib/components/addons/tests/__snapshots__/AddOnsNavigation.test.ts.snap index 77eee7d47..e297a7bd7 100644 --- a/src/lib/components/addons/tests/__snapshots__/AddOnsNavigation.test.ts.snap +++ b/src/lib/components/addons/tests/__snapshots__/AddOnsNavigation.test.ts.snap @@ -24,7 +24,7 @@ exports[`AddOnsNavigation 1`] = ` style="display: contents; --hover-background: var(--blue-2);" > @@ -43,7 +43,7 @@ exports[`AddOnsNavigation 1`] = ` All @@ -56,7 +56,7 @@ exports[`AddOnsNavigation 1`] = ` style="display: contents; --hover-background: var(--orange-2);" > @@ -80,7 +80,7 @@ exports[`AddOnsNavigation 1`] = ` Pinned @@ -93,7 +93,7 @@ exports[`AddOnsNavigation 1`] = ` style="display: contents; --hover-background: var(--yellow-2);" > @@ -112,7 +112,7 @@ exports[`AddOnsNavigation 1`] = ` Featured @@ -125,7 +125,7 @@ exports[`AddOnsNavigation 1`] = ` style="display: contents; --hover-background: var(--green-2);" > @@ -155,7 +155,7 @@ exports[`AddOnsNavigation 1`] = ` Premium @@ -172,14 +172,14 @@ exports[`AddOnsNavigation 1`] = ` style="display: contents; --color: var(--gray-4);" > Collections @@ -189,13 +189,13 @@ exports[`AddOnsNavigation 1`] = ` AI @@ -204,13 +204,13 @@ exports[`AddOnsNavigation 1`] = ` Analyze @@ -219,13 +219,13 @@ exports[`AddOnsNavigation 1`] = ` Bulk @@ -234,13 +234,13 @@ exports[`AddOnsNavigation 1`] = ` Export @@ -249,13 +249,13 @@ exports[`AddOnsNavigation 1`] = ` Extract @@ -264,13 +264,13 @@ exports[`AddOnsNavigation 1`] = ` File @@ -279,13 +279,13 @@ exports[`AddOnsNavigation 1`] = ` Monitor diff --git a/src/lib/components/documents/Access.svelte b/src/lib/components/common/Access.svelte similarity index 81% rename from src/lib/components/documents/Access.svelte rename to src/lib/components/common/Access.svelte index a8c106197..bd8f56e13 100644 --- a/src/lib/components/documents/Access.svelte +++ b/src/lib/components/common/Access.svelte @@ -22,7 +22,7 @@ }, ]; - export function getLevel(access: Access): Level | undefined { + export function getLevel(access: Access): Maybe { return levels.find((level) => level.value === access); } @@ -30,16 +30,18 @@ -
- - {$_(level.title)} -
+{#if level} +
+ + {$_(level.title)} +
+{/if} diff --git a/src/lib/components/layouts/AddOnLayout.svelte b/src/lib/components/layouts/AddOnLayout.svelte index 541bbafca..bb82772f3 100644 --- a/src/lib/components/layouts/AddOnLayout.svelte +++ b/src/lib/components/layouts/AddOnLayout.svelte @@ -12,7 +12,13 @@ import { _ } from "svelte-i18n"; import { setContext } from "svelte"; - import { Clock16, History16, Hourglass24, Play16 } from "svelte-octicons"; + import { + Clock16, + History16, + Hourglass24, + Play16, + SidebarExpand16, + } from "svelte-octicons"; import AddOnDispatch, { values } from "../forms/AddOnDispatch.svelte"; import AddOnMeta from "../addons/AddOnMeta.svelte"; @@ -33,6 +39,13 @@ import { schedules } from "../addons/ScheduledEvent.svelte"; import { getProcessLoader } from "../processing/ProcessContext.svelte"; + import SidebarLayout from "./SidebarLayout.svelte"; + import Documents from "../sidebar/Documents.svelte"; + import Projects from "../sidebar/Projects.svelte"; + import AddOns from "../sidebar/AddOns.svelte"; + import Flex from "../common/Flex.svelte"; + import { sidebars } from "./Sidebar.svelte"; + import Button from "../common/Button.svelte"; export let addon: AddOnListItem; export let event: Event | null = null; @@ -87,141 +100,179 @@ } -
-
-
-
- (currentTab = "dispatch")} - > - - {$_("addonDispatchDialog.dispatch")} - - - (currentTab = "history")} - > - - {$_("addonDispatchDialog.history")} - + + + + + + +
+
+
+ {#if !addon.parameters.documents && $sidebars["navigation"] === false} +
+ +
+ {/if} + +
+
+ (currentTab = "dispatch")} + > + + {$_("addonDispatchDialog.dispatch")} + - {#if canSchedule} (currentTab = "scheduled")} + active={currentTab === "history"} + on:click={() => (currentTab = "history")} > - - {$_("addonDispatchDialog.scheduled")} + + {$_("addonDispatchDialog.history")} - {/if} -
-
- {#if currentTab === "scheduled"} - {#await scheduled} - {$_("common.loading")} - {:then scheduled} - {#if scheduled} - - {/if} - {/await} - {:else if currentTab === "history"} -
- {#await history} + + {#if canSchedule} + (currentTab = "scheduled")} + > + + {$_("addonDispatchDialog.scheduled")} + + {/if} +
+
+ {#if currentTab === "scheduled"} + {#await scheduled} {$_("common.loading")} - {:then history} - {#if history} - - {:else} - {$_("addonDispatchDialog.noHistory")} {/if} {/await} -
- {:else} - - - {#await search then results} - + {#await history} + {$_("common.loading")} + {:then history} + {#if history} + + {:else} + {$_("addonDispatchDialog.noHistory")} + {/if} + {/await} +
+ {:else} + + + {#await search then results} + + {/await} + + + {/if} + +
+ {#if addon.parameters.documents} +
+ + + {#if $sidebars["navigation"] === false} +
+ +
+ {/if} + + + +
+ + {#await search} + {$_("common.loading")} + {:then search} + {/await} - - {/if} - - - {#if addon.parameters.documents} -
- - - - - - {#await search} - {$_("common.loading")} - {:then search} - - {/await} - - - + + - - {#if $visible && $total} - {$_("inputs.resultsCount", { - values: { n: $visible.size, total: $total }, - })} - {/if} - - - -
- {/if} -
+ + {#if $visible && $total} + {$_("inputs.resultsCount", { + values: { n: $visible.size, total: $total }, + })} + {/if} + + + +
+ {/if} + + diff --git a/src/lib/components/layouts/DocumentBrowser.svelte b/src/lib/components/layouts/DocumentBrowser.svelte index 36c2c39cf..a1d0102a0 100644 --- a/src/lib/components/layouts/DocumentBrowser.svelte +++ b/src/lib/components/layouts/DocumentBrowser.svelte @@ -36,7 +36,7 @@ // Form components import Dropzone from "$lib/components/inputs/Dropzone.svelte"; - import BulkActions from "$lib/components/documents/BulkActions.svelte"; + import DocumentActions from "$lib/components/sidebar/DocumentActions.svelte"; import Search from "$lib/components/forms/Search.svelte"; import { filesToUpload, @@ -233,7 +233,7 @@ - close()} /> + close()} /> diff --git a/src/lib/components/layouts/DocumentLayout.svelte b/src/lib/components/layouts/DocumentLayout.svelte index 1c02925bb..e2a26123f 100644 --- a/src/lib/components/layouts/DocumentLayout.svelte +++ b/src/lib/components/layouts/DocumentLayout.svelte @@ -3,16 +3,11 @@ Assumes it's a child of a ViewerContext --> - + + +
@@ -48,8 +51,12 @@
+ +

Document Actions

+ +

Project Actions

- +
@@ -72,4 +79,13 @@ border: 1px solid var(--gray-2); box-shadow: inset var(--shadow-2); } + h4 { + margin: 0; + font-size: var(--font-xs); + font-weight: 600; + color: var(--gray-4); + text-transform: uppercase; + letter-spacing: 1px; + padding: 0.5rem; + } diff --git a/src/lib/components/layouts/Sidebar.svelte b/src/lib/components/layouts/Sidebar.svelte index 2d9a3b5fa..ccdd40718 100644 --- a/src/lib/components/layouts/Sidebar.svelte +++ b/src/lib/components/layouts/Sidebar.svelte @@ -130,7 +130,7 @@ display: flex; flex-direction: column; position: relative; - gap: 1rem; + gap: 0.5rem; height: 100%; z-index: 0; } diff --git a/src/lib/components/layouts/stories/AppLayout.stories.svelte b/src/lib/components/layouts/stories/AppLayout.stories.svelte index 090437329..a60b768df 100644 --- a/src/lib/components/layouts/stories/AppLayout.stories.svelte +++ b/src/lib/components/layouts/stories/AppLayout.stories.svelte @@ -6,12 +6,12 @@ import DocumentBrowser from "../DocumentBrowser.svelte"; import SidebarLayout from "../SidebarLayout.svelte"; - import Documents from "@/routes/(app)/documents/sidebar/Documents.svelte"; - import Projects from "@/routes/(app)/documents/sidebar/Projects.svelte"; + import Documents from "@/lib/components/sidebar/Documents.svelte"; + import Projects from "@/lib/components/sidebar/Projects.svelte"; import Button from "../../common/Button.svelte"; import { PlusCircle16 } from "svelte-octicons"; - import BulkActions from "$lib/components/documents/BulkActions.svelte"; - import AddOns from "$lib/components/common/AddOns.svelte"; + import BulkActions from "@/lib/components/sidebar/DocumentActions.svelte"; + import AddOns from "@/lib/components/sidebar/AddOns.svelte"; import { documentsList } from "@/test/fixtures/documents"; import { addons } from "@/test/handlers/addons"; @@ -30,6 +30,9 @@ stores: { page: { url: "/", + data: { + pinnedAddons: Promise.resolve({ data: activeAddons }), + }, }, }, }, @@ -47,6 +50,7 @@ + @@ -56,7 +60,6 @@ {$_("sidebar.upload")} - diff --git a/src/lib/components/layouts/stories/SidebarLayout.stories.svelte b/src/lib/components/layouts/stories/SidebarLayout.stories.svelte index cfbe4faf5..6eb1b5282 100644 --- a/src/lib/components/layouts/stories/SidebarLayout.stories.svelte +++ b/src/lib/components/layouts/stories/SidebarLayout.stories.svelte @@ -2,16 +2,14 @@ import { Story, Template } from "@storybook/addon-svelte-csf"; import { _ } from "svelte-i18n"; - import { PlusCircle16 } from "svelte-octicons"; import SidebarLayout from "../SidebarLayout.svelte"; import DocumentBrowser from "../DocumentBrowser.svelte"; - import Button from "$lib/components/common/Button.svelte"; - - import BulkActions from "$lib/components/documents/BulkActions.svelte"; - import AddOns from "@/lib/components/common/AddOns.svelte"; - import Documents from "@/routes/(app)/documents/sidebar/Documents.svelte"; - import Projects from "@/routes/(app)/documents/sidebar/Projects.svelte"; + import UploadButton from "$lib/components/sidebar/UploadButton.svelte"; + import DocumentActions from "$lib/components/sidebar/DocumentActions.svelte"; + import AddOnsNavigation from "$lib/components/sidebar/AddOns.svelte"; + import DocumentsNavigation from "$lib/components/sidebar/Documents.svelte"; + import ProjectsNavigation from "$lib/components/sidebar/Projects.svelte"; import { documentsList } from "@/test/fixtures/documents"; import { activeAddons } from "@/test/fixtures/addons"; @@ -29,6 +27,9 @@ stores: { page: { url: "/", + data: { + pinnedAddons: Promise.resolve({ data: activeAddons }), + }, }, }, }, @@ -44,18 +45,16 @@
- - + + + - - - + +
diff --git a/src/lib/components/navigation/OrgMenu.svelte b/src/lib/components/navigation/OrgMenu.svelte index 9c8b775bc..baf05a2c3 100644 --- a/src/lib/components/navigation/OrgMenu.svelte +++ b/src/lib/components/navigation/OrgMenu.svelte @@ -226,6 +226,7 @@ font-family: var(--font-sans, "Source Sans Pro"); font-weight: var(--font-semibold, 600); line-height: 1rem; + margin-bottom: 0; } .arrow { diff --git a/src/lib/components/projects/Collaborators.svelte b/src/lib/components/projects/Collaborators.svelte index 63f5d97fe..734024c88 100644 --- a/src/lib/components/projects/Collaborators.svelte +++ b/src/lib/components/projects/Collaborators.svelte @@ -26,6 +26,7 @@ import { getUserName } from "$lib/api/accounts"; import { getCurrentUser } from "@/lib/utils/permissions"; + import Tooltip from "../common/Tooltip.svelte"; export let project: Project; export let users: ProjectUser[]; @@ -69,77 +70,112 @@ getUserName(a.user).localeCompare(getUserName(b.user)), ); } - - - - - {$_("projects.collaborators.title")} - + function group(users: ProjectUser[]) { + const groups: Record = { + admin: [], + edit: [], + view: [], + }; + + users.forEach((user) => { + groups[user.access].push(user); + }); + + return groups; + } + - {#if users.length > 0 && project.add_remove_access} - (show = "invite")}> - - {$_("projects.collaborators.add")} +{#if users.length > 0 || project.add_remove_access} + + + + {$_("projects.collaborators.title")} - {/if} - - {#each sort(users) as user} - {#if isProjectUser || project.edit_access} - - - {getUserName(user.user)} - - {$_(accessLabels[user.access])} - {#if project.add_remove_access && !isMe(user, $me)} - - - {/if} - - - {:else} - - - {getUserName(user.user)} - - {/if} - {:else} - - {$_("projects.collaborators.empty")} + + {#if project.add_remove_access} - (show = "invite")}> + + {/if} + + + {#each Object.entries(group(sort(users))) as [key, members]} + {#if members.length} +
+

{$_(accessLabels[key])}

+
{/if} -
- {/each} -
+ {#each members as user} + {#if isProjectUser || project.edit_access} + + + {getUserName(user.user)} + + {#if project.add_remove_access && !isMe(user, $me)} + + + + + + + {/if} + + + {:else} + + + {getUserName(user.user)} + + {/if} + {/each} + {:else} + + {$_("projects.collaborators.empty")} + {#if project.add_remove_access} + (show = "invite")}> + {$_("projects.collaborators.add")} + + {/if} + + {/each} +
+{/if} -{#if show} +{#if show && project.add_remove_access}

{actions[show]}

@@ -160,14 +196,13 @@ {/if} diff --git a/src/lib/components/projects/ProjectActions.svelte b/src/lib/components/projects/ProjectActions.svelte deleted file mode 100644 index b92545f61..000000000 --- a/src/lib/components/projects/ProjectActions.svelte +++ /dev/null @@ -1,127 +0,0 @@ - - - - -
- {#if isSignedIn($me) && canUploadFiles($me) && project.edit_access} - - {/if} - - {#if project.edit_access || project.add_remove_access} - -
- {#if project.edit_access} - - {/if} - - {#if project.edit_access} - - {/if} -
- {/if} - - -
- - - -
-
- -{#if show} - - -

- {actions[show]} -

- {#if show === "edit"} - - {/if} - - {#if show === "share"} - - {/if} - - {#if show === "delete"} - - {/if} -
-
-{/if} - - diff --git a/src/lib/components/projects/ProjectHeader.svelte b/src/lib/components/projects/ProjectHeader.svelte index 4a1d3391b..b96016d36 100644 --- a/src/lib/components/projects/ProjectHeader.svelte +++ b/src/lib/components/projects/ProjectHeader.svelte @@ -5,6 +5,7 @@ import Flex from "$lib/components/common/Flex.svelte"; import { remToPx } from "$lib/utils/layout"; import ProjectPin from "./ProjectPin.svelte"; + import Access, { getLevel } from "../common/Access.svelte"; export let project: Project; export let show = { @@ -29,9 +30,9 @@ {#if show.access}
{#if project.private} - {$_("projects.access.private")} + {:else} - {$_("projects.access.public")} + {/if}
{/if} diff --git a/src/lib/components/common/AddOns.svelte b/src/lib/components/sidebar/AddOns.svelte similarity index 55% rename from src/lib/components/common/AddOns.svelte rename to src/lib/components/sidebar/AddOns.svelte index 4363eecae..a9c8e8ba6 100644 --- a/src/lib/components/common/AddOns.svelte +++ b/src/lib/components/sidebar/AddOns.svelte @@ -1,29 +1,30 @@ -{#each Object.entries(actions) as [action, [label, icon]]} - { - show(action); - afterClick?.(); - }} - > - - {$_(label)} - -{/each} + + {#each Object.entries(actions) as [action, [label, icon, mode]]} + + {/each} + {#if visible} diff --git a/src/routes/(app)/documents/sidebar/Documents.svelte b/src/lib/components/sidebar/Documents.svelte similarity index 67% rename from src/routes/(app)/documents/sidebar/Documents.svelte rename to src/lib/components/sidebar/Documents.svelte index fb74e5771..efafb2fdf 100644 --- a/src/routes/(app)/documents/sidebar/Documents.svelte +++ b/src/lib/components/sidebar/Documents.svelte @@ -5,15 +5,15 @@ import { getContext } from "svelte"; import { _ } from "svelte-i18n"; import { + Search16, File16, Globe16, - Infinity16, Lock16, Organization16, + Person16, } from "svelte-octicons"; import { page } from "$app/stores"; - import Flex from "$lib/components/common/Flex.svelte"; import SidebarItem from "$lib/components/sidebar/SidebarItem.svelte"; import SignedIn from "$lib/components/common/SignedIn.svelte"; @@ -21,6 +21,8 @@ import { slugify } from "$lib/utils/slugify"; import { userDocs } from "$lib/utils/search"; import { getCurrentUser } from "@/lib/utils/permissions"; + import SidebarGroup from "@/lib/components/sidebar/SidebarGroup.svelte"; + import Button from "@/lib/components/common/Button.svelte"; const me = getCurrentUser(); const org: Writable = getContext("org"); @@ -43,47 +45,61 @@ } - - - - {$_("documents.allDocuments", { - values: { access: "" }, - })} + + + + Documents - + - - + + {$_("documents.yourDocuments")} - - + {$_("documents.accessDocuments", { - values: { access: "Public " }, + values: { access: "Private " }, })} - + {$_("documents.accessDocuments", { - values: { access: "Private " }, + values: { access: "Public " }, })} {#if $org && !$org.individual} - - + + {$_("documents.nameDocuments", { values: { name: $org.name, access: "" }, })} {/if} - + diff --git a/src/lib/components/sidebar/ProjectActions.svelte b/src/lib/components/sidebar/ProjectActions.svelte new file mode 100644 index 000000000..1fba9980a --- /dev/null +++ b/src/lib/components/sidebar/ProjectActions.svelte @@ -0,0 +1,78 @@ + + + + + + + + {#if project.edit_access || project.add_remove_access} + + {#if project.edit_access} + + {/if} + + {#if project.edit_access} + + {/if} + {/if} + + +{#if show} + + +

+ {actions[show]} +

+ {#if show === "edit"} + + {/if} + + {#if show === "share"} + + {/if} + + {#if show === "delete"} + + {/if} +
+
+{/if} diff --git a/src/lib/components/sidebar/Projects.svelte b/src/lib/components/sidebar/Projects.svelte new file mode 100644 index 000000000..b71ab68a9 --- /dev/null +++ b/src/lib/components/sidebar/Projects.svelte @@ -0,0 +1,82 @@ + + + + + + {$_("sidebar.projects.title")} + + + + + {$_("projects.yours")} + + + + {$_("projects.shared")} + + {#await pinned} + {$_("common.loading")} + {:then projects} + {#each sort(projects) as project} + + + {project.title} + + {:else} + + + {$_("sidebar.projects.pinned")} + + {/each} + {/await} + + diff --git a/src/lib/components/sidebar/SidebarGroup.svelte b/src/lib/components/sidebar/SidebarGroup.svelte index 0a31904d1..51e4543e4 100644 --- a/src/lib/components/sidebar/SidebarGroup.svelte +++ b/src/lib/components/sidebar/SidebarGroup.svelte @@ -48,7 +48,12 @@
{#if $$slots.title}{/if} - + {#if $$slots.action}{/if} {/if} {#if !collapsed} @@ -63,6 +68,7 @@ display: flex; flex-direction: column; gap: 0.25rem; + padding-bottom: 1rem; } header { flex: 1 0 0; diff --git a/src/lib/components/sidebar/SidebarItem.svelte b/src/lib/components/sidebar/SidebarItem.svelte index 49462e194..79b6e20b6 100644 --- a/src/lib/components/sidebar/SidebarItem.svelte +++ b/src/lib/components/sidebar/SidebarItem.svelte @@ -87,7 +87,7 @@ .container.hover:hover, .container.hover:focus { cursor: pointer; - background: var(--hover-background, var(--gray-1, #d8dee2)); + background: var(--hover-background, var(--blue-1, #d8dee2)); color: var(--hover-color, var(--color, inherit)); fill: var(--hover-fill, var(--fill, inherit)); } diff --git a/src/lib/components/sidebar/UploadButton.svelte b/src/lib/components/sidebar/UploadButton.svelte new file mode 100644 index 000000000..2aede1fb1 --- /dev/null +++ b/src/lib/components/sidebar/UploadButton.svelte @@ -0,0 +1,40 @@ + + +{#if isSignedIn($me) && canUploadFiles($me)} + {#if project} + + {:else} + + {/if} +{/if} diff --git a/src/lib/components/documents/Actions.svelte b/src/lib/components/sidebar/ViewerActions.svelte similarity index 97% rename from src/lib/components/documents/Actions.svelte rename to src/lib/components/sidebar/ViewerActions.svelte index 6751eb7f0..2afc6d3b4 100644 --- a/src/lib/components/documents/Actions.svelte +++ b/src/lib/components/sidebar/ViewerActions.svelte @@ -22,8 +22,8 @@ import PremiumBadge from "$lib/components/premium-credits/PremiumBadge.svelte"; import UpgradePrompt from "$lib/components/premium-credits/UpgradePrompt.svelte"; - import Revisions from "./Revisions.svelte"; - import Share from "./Share.svelte"; + import Revisions from "$lib/components/documents/Revisions.svelte"; + import Share from "$lib/components/documents/Share.svelte"; import { getUpgradeUrl } from "$lib/api/accounts"; import { pdfUrl } from "$lib/api/documents"; @@ -44,6 +44,16 @@
+
+ + +
{#if document.edit_access}
- {/if} -
- - -
- {#if document.edit_access}
- {/if} - - - {/if} + + diff --git a/src/routes/(app)/documents/+page.ts b/src/routes/(app)/documents/+page.ts index 6e14acba5..f1ea847b5 100644 --- a/src/routes/(app)/documents/+page.ts +++ b/src/routes/(app)/documents/+page.ts @@ -1,8 +1,7 @@ -import type { DocumentResults, SearchOptions } from "$lib/api/types"; +import type { SearchOptions } from "$lib/api/types"; import { DEFAULT_PER_PAGE } from "@/config/config.js"; import { search } from "$lib/api/documents"; -import { getPinnedAddons } from "$lib/api/addons.js"; export async function load({ url, fetch, data }) { const query = url.searchParams.get("q") || ""; @@ -24,14 +23,11 @@ export async function load({ url, fetch, data }) { const searchResults = search(query, options, fetch); - const pinnedAddons = getPinnedAddons(fetch); - return { ...data, query, per_page, cursor, searchResults, - pinnedAddons, }; } diff --git a/src/routes/(app)/documents/[id]-[slug]/+page.svelte b/src/routes/(app)/documents/[id]-[slug]/+page.svelte index 60a4d8d5b..3cd09c3da 100644 --- a/src/routes/(app)/documents/[id]-[slug]/+page.svelte +++ b/src/routes/(app)/documents/[id]-[slug]/+page.svelte @@ -25,7 +25,6 @@ $: canonical_url = documents.canonicalUrl(document).href; $: action = data.action; - $: addons = data.pinnedAddons; $: hasDescription = Boolean(document.description?.trim().length); $: query = data.query || ""; @@ -67,6 +66,6 @@ - + diff --git a/src/routes/(app)/documents/[id]-[slug]/+page.ts b/src/routes/(app)/documents/[id]-[slug]/+page.ts index 3f86b3942..f652c087b 100644 --- a/src/routes/(app)/documents/[id]-[slug]/+page.ts +++ b/src/routes/(app)/documents/[id]-[slug]/+page.ts @@ -8,7 +8,6 @@ import type { ReadMode } from "@/lib/api/types"; import { redirect } from "@sveltejs/kit"; import * as documents from "$lib/api/documents"; -import { getPinnedAddons } from "$lib/api/addons"; import { breadcrumbTrail } from "$lib/utils/index"; import loadDocument from "$lib/load/document"; @@ -39,9 +38,6 @@ export async function load({ fetch, params, parent, depends, url }) { { href: canonical.pathname, title: document.title }, ]); - // stream this - const pinnedAddons = getPinnedAddons(fetch); - const query = getQuery(url); return { @@ -49,7 +45,6 @@ export async function load({ fetch, params, parent, depends, url }) { mode, asset_url, action, - pinnedAddons, breadcrumbs, query, }; diff --git a/src/routes/(app)/documents/sidebar/Projects.svelte b/src/routes/(app)/documents/sidebar/Projects.svelte deleted file mode 100644 index ad438ed22..000000000 --- a/src/routes/(app)/documents/sidebar/Projects.svelte +++ /dev/null @@ -1,53 +0,0 @@ - - - - - {$_("sidebar.projects.title")} - - - {$_("common.explore")} - - - {#await pinned} - {$_("common.loading")} - {:then projects} - {#each sort(projects) as project} - - - {project.title} - - {:else} - {$_("sidebar.projects.pinned")} - {/each} - {/await} - - diff --git a/src/routes/(app)/projects/+page.svelte b/src/routes/(app)/projects/+page.svelte index 12ba9c2d9..4c3648e29 100644 --- a/src/routes/(app)/projects/+page.svelte +++ b/src/routes/(app)/projects/+page.svelte @@ -15,12 +15,10 @@ import Button from "$lib/components/common/Button.svelte"; import ContentLayout from "$lib/components/layouts/ContentLayout.svelte"; import Empty from "$lib/components/common/Empty.svelte"; - import Flex from "$lib/components/common/Flex.svelte"; import PageToolbar from "$lib/components/common/PageToolbar.svelte"; import Paginator from "$lib/components/common/Paginator.svelte"; import ProjectListItem from "$lib/components/projects/ProjectListItem.svelte"; import Search from "$lib/components/forms/Search.svelte"; - import SidebarItem from "$lib/components/sidebar/SidebarItem.svelte"; import SidebarLayout from "@/lib/components/layouts/SidebarLayout.svelte"; import EditProject from "@/lib/components/forms/EditProject.svelte"; @@ -28,6 +26,9 @@ import Portal from "$lib/components/layouts/Portal.svelte"; import { getCurrentUser } from "$lib/utils/permissions"; + import Documents from "@/lib/components/sidebar/Documents.svelte"; + import Projects from "@/lib/components/sidebar/Projects.svelte"; + import AddOns from "@/lib/components/sidebar/AddOns.svelte"; const me = getCurrentUser(); @@ -57,22 +58,9 @@ - - {#if $me} - - - {$_("projects.yours")} - - - - {$_("projects.shared")} - - {/if} - - - {$_("projects.public")} - - + + + diff --git a/src/routes/(app)/projects/[id]-[slug]/+page.svelte b/src/routes/(app)/projects/[id]-[slug]/+page.svelte index c33e1ef9f..608f7df07 100644 --- a/src/routes/(app)/projects/[id]-[slug]/+page.svelte +++ b/src/routes/(app)/projects/[id]-[slug]/+page.svelte @@ -1,6 +1,8 @@ @@ -36,4 +39,4 @@ {/if} - + diff --git a/src/routes/(app)/projects/[id]-[slug]/+page.ts b/src/routes/(app)/projects/[id]-[slug]/+page.ts index 84d8a1381..578166830 100644 --- a/src/routes/(app)/projects/[id]-[slug]/+page.ts +++ b/src/routes/(app)/projects/[id]-[slug]/+page.ts @@ -12,7 +12,6 @@ import * as projects from "$lib/api/projects"; import * as collaborators from "$lib/api/collaborators"; import { search } from "$lib/api/documents"; import { breadcrumbTrail } from "$lib/utils/navigation"; -import { getPinnedAddons } from "$lib/api/addons"; export async function load({ params, url, parent, data, fetch }) { const id = parseInt(params.id, 10); @@ -52,9 +51,6 @@ export async function load({ params, url, parent, data, fetch }) { fetch, ); - // stream this - const pinnedAddons = getPinnedAddons(fetch); - return { ...(data ?? {}), // include csrf_token breadcrumbs, @@ -62,6 +58,5 @@ export async function load({ params, url, parent, data, fetch }) { query, project: project.data, users, - pinnedAddons, }; } diff --git a/src/routes/(app)/upload/+page.svelte b/src/routes/(app)/upload/+page.svelte index 04a73abe2..91795dde0 100644 --- a/src/routes/(app)/upload/+page.svelte +++ b/src/routes/(app)/upload/+page.svelte @@ -1,14 +1,11 @@