Skip to content

Commit

Permalink
Fix text
Browse files Browse the repository at this point in the history
  • Loading branch information
eyeseast committed Nov 20, 2024
2 parents 9bd262e + 74ef31f commit fecbf8f
Show file tree
Hide file tree
Showing 14 changed files with 97 additions and 31 deletions.
5 changes: 3 additions & 2 deletions src/langs/json/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@
"dismiss": "Dismiss",
"dispatch": "Dispatch",
"organize": "Organize",
"run": "Run"
"run": "Run",
"required": "This field is required"
},
"dialogReprocessDialog": {
"title": "Confirm reprocess",
Expand Down Expand Up @@ -188,7 +189,7 @@
"noSearchResults": "No search results",
"queryNoResults": "Your search query returned no results. Try again with a broader search query.",
"welcome": "Welcome to DocumentCloud!",
"verify": "Before you can upload documents, you need to be verify your account. You can do this by joining a verified news organization or by requesting verification for yourself.",
"verify": "Before you can upload documents, you need to verify your account. You can do this by joining a verified news organization or by requesting verification for yourself.",
"allowed_actions": "Until you're verified, you can search through the public repository, organize documents you're interested in into projects, leave private notes, and collaborate on editing and annotating documents other users invite you to.",
"requestVerificationAction": "Request verification",
"orgs": "Search organizations",
Expand Down
8 changes: 6 additions & 2 deletions src/lib/components/accounts/Unverified.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,14 @@ a user who is logged in but has `verified_journalist = false`.
<Unverified24 slot="icon" />
<p>{$_("unverified.verify")}</p>
<Flex class="buttons" gap={1}>
<Button href={SQUARELET_ORGS_URL} target="_blank">
<Button mode="primary" href={SQUARELET_ORGS_URL} target="_blank">
{$_("unverified.orgs")}
</Button>
<Button href={prefill(VERIFICATION_FORM_URL, user)} target="_blank">
<Button
mode="primary"
href={prefill(VERIFICATION_FORM_URL, user)}
target="_blank"
>
{$_("unverified.requestVerificationAction")}
</Button>
</Flex>
Expand Down
1 change: 1 addition & 0 deletions src/lib/components/common/KV.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -48,5 +48,6 @@
.value {
color: var(--blue-5, #153359);
font-style: normal;
word-break: break-all;
}
</style>
15 changes: 15 additions & 0 deletions src/lib/components/common/stories/KV.stories.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,18 @@
<Story name="no link">
<KV key="Project" value="Old Computer Project" />
</Story>

<Story name="Long Value">
<div class="constrain-width">
<KV
key="id"
value="f2a6eaad9a6ebf4753bacd1e9731f29d67c2b84b7098165d2ae9cb83797c52452d66f8d6c342fd29a4229c31b7cd55ad91324be9f897fe5a4b858055d2f0ec65"
/>
</div>
</Story>

<style>
.constrain-width {
max-width: 20rem;
}
</style>
1 change: 1 addition & 0 deletions src/lib/components/documents/Header.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
font-weight: var(--font-semibold);
font-size: var(--font-xl);
line-height: 1.2;
word-break: break-all;
}
.access {
flex: 0 1 auto;
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/documents/NoteHighlights.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
import HighlightGroup from "../common/HighlightGroup.svelte";
export let document: Document;
export let open = false;
export let open = true;
$: highlights = Object.entries(document.note_highlights ?? {});
$: notes = new Map(document.notes?.map((n) => [n.id, n]));
Expand Down
2 changes: 1 addition & 1 deletion src/lib/components/documents/PageHighlights.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import { pageNumber } from "$lib/utils/search";
export let document: Document;
export let open = false;
export let open = true;
$: highlights = Object.entries(document.highlights ?? {});
Expand Down
11 changes: 11 additions & 0 deletions src/lib/components/documents/stories/Header.stories.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,14 @@
name="With HTML description"
args={{ document: { ...document, description: html } }}
/>

<Story
name="With Long Title"
args={{
document: {
...document,
title:
"This%20is%20an%20unbroken%20title%20that%20just%20goes%20on%20and%20on%20and%20on%20why%20did%20nobody%20edit%20it%3F",
},
}}
/>
6 changes: 3 additions & 3 deletions src/lib/components/forms/DocumentUpload.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ progress through the three-part upload process.
const form = new FormData(e.target as HTMLFormElement);
const access = form.get("access") as Access;
const titles = form.getAll("title") as string[];
const access = (form.get("access") as Access) ?? "private";
const titles = (form.getAll("title") as string[]) ?? [];
const revision_control = form.get("revision_control") === "on";
// only run on files that are "ready" and haven't started uploading
Expand Down Expand Up @@ -364,7 +364,7 @@ progress through the three-part upload process.

<Field>
<FieldLabel>{$_("uploadDialog.accessLevel")}</FieldLabel>
<AccessLevel name="access" bind:selected={access} />
<AccessLevel name="access" bind:selected={access} required />
</Field>
<Field>
<FieldLabel>{$_("uploadDialog.projects")}</FieldLabel>
Expand Down
4 changes: 3 additions & 1 deletion src/lib/components/forms/UploadListItem.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,10 @@

<style>
.title {
flex: 1 0 auto;
flex: 1 1 auto;
max-width: 100%;
}
.fileInfo {
flex: 0 1 0;
font-size: var(--font-xs);
Expand Down
16 changes: 16 additions & 0 deletions src/lib/components/forms/stories/DocumentUpload.stories.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,19 @@
/>

<Story name="Unverified user" args={{ ...args, user: writable(user) }} />

<Story
name="With Long File Name"
args={{
...args,
files: [
new File(
[new ArrayBuffer(128000)],
"f2a6eaad9a6ebf4753bacd1e9731f29d67c2b84b7098165d2ae9cb83797c52452d66f8d6c342fd29a4229c31b7cd55ad91324be9f897fe5a4b858055d2f0ec65.pdf",
{
type: "application/pdf",
},
),
],
}}
/>
55 changes: 34 additions & 21 deletions src/lib/components/inputs/AccessLevel.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -43,30 +43,39 @@
export let name: string;
export let selected: Access = levels[0]!.value;
export let direction: "column" | "row" = "column";
export let required = false;
</script>

<Flex {direction} gap={0.5}>
{#each levels as level}
<div class="option" class:selected={level.value === selected}>
<input
class="sr-only"
type="radio"
{name}
id={level.value}
bind:group={selected}
value={level.value}
/>
<label for={level.value} class="detail">
<Flex gap={0.5}>
<svelte:component this={level.icon} />
<Flex direction="column" gap={0.125}>
<p class="title">{level.title}</p>
<p class="description">{level.description}</p>
<Flex direction="column">
{#if required && !selected}
<p class="error">
{$_("dialog.required")}
</p>
{/if}
<Flex {direction} gap={0.5}>
{#each levels as level}
<div class="option" class:selected={level.value === selected}>
<label for={level.value} class="detail">
<Flex gap={0.5}>
<svelte:component this={level.icon} />
<Flex direction="column" gap={0.125}>
<p class="title">{level.title}</p>
<p class="description">{level.description}</p>
</Flex>
</Flex>
</Flex>
</label>
</div>
{/each}
<input
class="sr-only"
type="radio"
{name}
id={level.value}
bind:group={selected}
value={level.value}
{required}
/>
</label>
</div>
{/each}
</Flex>
</Flex>

<style>
Expand Down Expand Up @@ -96,6 +105,10 @@
font-size: var(--font-xs);
opacity: 0.7;
}
.error {
color: var(--error);
}
.sr-only {
position: absolute;
clip: rect(1px, 1px, 1px, 1px);
Expand Down
1 change: 1 addition & 0 deletions src/lib/components/inputs/Field.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
margin: 0.5rem 0;
font-size: var(--font-sm, 0.875em);
color: var(--gray-4);
word-break: break-all;
}
.inline.field {
width: 100%;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@
<Story name="Organization" args={{ ...args, selected: "organization" }} />
<Story name="Public" args={{ ...args, selected: "public" }} />
<Story name="Row" args={{ ...args, direction: "row" }} />
<Story name="Required" args={{ required: true, selected: null }} />

0 comments on commit fecbf8f

Please sign in to comment.