Skip to content

Commit

Permalink
Merge pull request #911 from MuckRock/legacy-links
Browse files Browse the repository at this point in the history
Add link and messaging about search and legacy mode
  • Loading branch information
eyeseast authored Dec 2, 2024
2 parents 2eae3bc + b5365b8 commit ef07264
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/lib/components/layouts/DocumentLayout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ Assumes it's a child of a ViewerContext
import type { Project } from "$lib/api/types";
import { _ } from "svelte-i18n";
import ViewerActions from "$lib/components/sidebar/ViewerActions.svelte";
import AddOns from "$lib/components/sidebar/AddOns.svelte";
import Avatar from "../accounts/Avatar.svelte";
import Data from "../documents/Data.svelte";
Expand All @@ -18,6 +17,7 @@ Assumes it's a child of a ViewerContext
import Projects from "../documents/Projects.svelte";
import SidebarLayout from "./SidebarLayout.svelte";
import Viewer from "../viewer/Viewer.svelte";
import ViewerActions from "$lib/components/sidebar/ViewerActions.svelte";
import { getCurrentUser } from "$lib/utils/permissions";
import { isOrg } from "$lib/api/accounts";
Expand Down
15 changes: 14 additions & 1 deletion src/lib/components/sidebar/ViewerActions.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
Pencil16,
Share16,
Trash16,
Undo16,
} from "svelte-octicons";
import Button from "$lib/components/common/Button.svelte";
Expand All @@ -26,7 +27,7 @@
import Share from "$lib/components/documents/Share.svelte";
import { getUpgradeUrl } from "$lib/api/accounts";
import { pdfUrl } from "$lib/api/documents";
import { pdfUrl, canonicalUrl } from "$lib/api/documents";
export let document: Document;
export let user: User;
Expand All @@ -41,6 +42,11 @@
$: organization =
typeof user?.organization === "object" ? (user.organization as Org) : null;
$: plan = organization?.plan ?? "Free";
$: canonical = canonicalUrl(document);
$: legacy = new URL(
canonical.pathname,
"https://legacy.www.documentcloud.org",
);
</script>

<div class="actions wideGap">
Expand All @@ -53,6 +59,10 @@
<Share16 />
{$_("sidebar.shareEmbed")}
</Button>
<Button ghost href={legacy.href} minW={false}>
<Undo16 />
<span class="legacy">View in Legacy DocumentCloud</span>
</Button>
</div>
{#if document.edit_access}
<div class="actions">
Expand Down Expand Up @@ -170,4 +180,7 @@
.wideGap {
gap: 1rem;
}
.legacy {
text-align: left;
}
</style>
9 changes: 7 additions & 2 deletions src/lib/components/viewer/ReadingToolbar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,10 @@ Assumes it's a child of a ViewerContext
import Menu from "$lib/components/common/Menu.svelte";
import MenuItem from "$lib/components/common/MenuItem.svelte";
import PageToolbar from "$lib/components/common/PageToolbar.svelte";
import Tab from "$lib/components/common/Tab.svelte";
import Search from "$lib/components/forms/Search.svelte";
import SidebarItem from "../sidebar/SidebarItem.svelte";
import Tab from "$lib/components/common/Tab.svelte";
import Tooltip from "../common/Tooltip.svelte";
import { remToPx } from "$lib/utils/layout";
import { getViewerHref } from "$lib/utils/viewer";
Expand Down Expand Up @@ -147,7 +148,11 @@ Assumes it's a child of a ViewerContext
</Menu>
</Dropdown>
{:else}
<Search name="q" {query} />
<Tooltip
caption="For advanced searches, view in legacy DocumentCloud for now."
>
<Search name="q" {query} />
</Tooltip>
{/if}
</Flex>
</PageToolbar>
Expand Down

0 comments on commit ef07264

Please sign in to comment.