Skip to content

Commit

Permalink
Search links, while I'm here
Browse files Browse the repository at this point in the history
  • Loading branch information
eyeseast committed Apr 9, 2024
1 parent d505236 commit 13ed8ce
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 7 deletions.
46 changes: 39 additions & 7 deletions src/routes/app/sidebar/Documents.svelte
Original file line number Diff line number Diff line change
@@ -1,19 +1,51 @@
<script lang="ts">
import type { User, Org } from "@/api/types/orgAndUser";
import type { Writable } from "svelte/store";
import { getContext } from "svelte";
import { _ } from "svelte-i18n";
import Flex from "@/lib/components/common/Flex.svelte";
import SidebarItem from "@/lib/components/sidebar/SidebarItem.svelte";
import { Globe16, Infinity16, Lock16, Organization16 } from "svelte-octicons";
import SignedIn from "@/lib/components/common/SignedIn.svelte";
import Flex from "$lib/components/common/Flex.svelte";
import SidebarItem from "$lib/components/sidebar/SidebarItem.svelte";
import SignedIn from "$lib/components/common/SignedIn.svelte";
import { APP_URL } from "@/config/config";
import { slugify } from "@/util/string.js";
const me: Writable<User> = getContext("me");
const org: Writable<Org> = getContext("org");
// +user:chris-amico-1020 +access:public
$: mine = `+user:${slugify($me.name)}-${$me.id}`;
$: minePublic = `${mine} +access:public`;
$: minePrivate = `${mine} +access:private`;
// +organization:muckrock-125
$: orgDocs = `+organization:${slugify($org.name)}-${$org.id}`;
function searchUrl(query: string) {
const q = new URLSearchParams([["q", query]]);
const u = new URL("/app/", APP_URL);
u.search = q.toString();
return u.toString();
}
</script>

<Flex direction="column">
<SidebarItem hover><Infinity16 /> {$_("projects.allDocuments")}</SidebarItem>
<SidebarItem hover href={searchUrl("")}
><Infinity16 /> {$_("projects.allDocuments")}</SidebarItem
>
<SignedIn>
<SidebarItem hover
<SidebarItem hover href={searchUrl(minePublic)}
><Globe16 /> {$_("projects.yourPubDocuments")}</SidebarItem
>
<SidebarItem hover><Lock16 /> {$_("projects.yourDocuments")}</SidebarItem>
<SidebarItem hover>
<SidebarItem hover href={searchUrl(minePrivate)}
><Lock16 /> {$_("projects.yourDocuments")}</SidebarItem
>
<SidebarItem hover href={searchUrl(orgDocs)}>
<Organization16 />
{$_("projects.orgDocuments", {
values: { name: "MuckRock" },
Expand Down
5 changes: 5 additions & 0 deletions src/routes/app/upload/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@
<p>
{form.message}
</p>
{:else}
<p>
Select or drag a document to begin the document upload process. You will
then be able to edit document information.
</p>
{/if}

<DocumentUpload />
Expand Down

0 comments on commit 13ed8ce

Please sign in to comment.