Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sveltekit projects writable #647

Merged
merged 20 commits into from
Sep 11, 2024
Merged

sveltekit projects writable #647

merged 20 commits into from
Sep 11, 2024

Conversation

eyeseast
Copy link
Collaborator

@eyeseast eyeseast commented Sep 3, 2024

Full project lifecycle:

  • create
  • update
  • delete

Project user management:

  • add collaborator
  • remove collaborator
  • change access

Documents:

  • add to and remove from project

Plus lots of small fixes. When this is merged, projects are done.

Closes #643, #642, #210

Copy link

github-actions bot commented Sep 3, 2024

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 31.33% 5767 / 18405
🔵 Statements 31.33% 5767 / 18405
🔵 Functions 38.32% 105 / 274
🔵 Branches 53.1% 291 / 548
File Coverage
File Stmts % Branch % Funcs % Lines Uncovered Lines
Changed Files
src/lib/api/collaborators.ts 88.46% 50% 100% 88.46% 36-37, 40-43, 72-73, 76-79
src/lib/api/projects.ts 84.53% 77.14% 92.3% 84.53% 176-177, 180-182, 207-208, 211-213, 271-272, 276-283, 308-309, 313-320, 331-356
src/lib/api/types.d.ts 0% 0% 0% 0% 1-283
src/lib/components/addons/AddOnListItem.svelte 100% 100% 100% 100%
src/lib/components/common/Action.svelte 0% 0% 0% 0% 1-57
src/lib/components/forms/BulkActions.svelte 0% 0% 0% 0% 1-120
src/lib/components/forms/DeleteProject.svelte 0% 0% 0% 0% 1-44
src/lib/components/forms/EditProject.svelte 0% 0% 0% 0% 1-81
src/lib/components/forms/ManageCollaborators.svelte 0% 0% 0% 0% 1-181
src/lib/components/forms/Projects.svelte 0% 0% 0% 0% 1-165
src/lib/components/forms/Search.svelte 0% 0% 0% 0% 1-115
src/lib/components/inputs/Field.svelte 0% 0% 0% 0% 1-54
src/lib/components/projects/Collaborators.svelte 0% 0% 0% 0% 1-67
src/lib/components/projects/ProjectActions.svelte 0% 0% 0% 0% 1-103
src/lib/components/projects/ProjectListItem.svelte 0% 0% 0% 0% 1-107
src/lib/components/projects/ProjectPin.svelte 0% 0% 0% 0% 1-51
src/routes/documents/+page.svelte 0% 0% 0% 0% 1-146
src/routes/documents/[id]-[slug]/+layout.svelte 0% 0% 0% 0% 1-88
src/routes/documents/[id]-[slug]/+layout.ts 0% 0% 0% 0% 1
src/routes/documents/[id]-[slug]/+page.server.ts 0% 0% 0% 0% 1
src/routes/documents/[id]-[slug]/sidebar/Projects.svelte 0% 0% 0% 0% 1-60
src/routes/documents/projects/+page.server.ts 0% 0% 0% 0% 1-29
src/routes/documents/projects/+page.svelte 0% 0% 0% 0% 1-109
src/routes/documents/projects/+page.ts 0% 0% 0% 0% 1
src/routes/documents/projects/[id]-[slug]/+page.server.ts 0% 0% 0% 0% 1-114
src/routes/documents/projects/[id]-[slug]/+page.svelte 0% 0% 0% 0% 1-131
src/routes/documents/projects/[id]-[slug]/+page.ts 0% 0% 0% 0% 1
src/routes/documents/sidebar/Projects.svelte 0% 0% 0% 0% 1-53
Generated in workflow #344

Copy link

netlify bot commented Sep 3, 2024

Deploy Preview for documentcloud-frontend ready!

Name Link
🔨 Latest commit 5d2d0f4
🔍 Latest deploy log https://app.netlify.com/sites/documentcloud-frontend/deploys/66e1c003abf581000878ef62
😎 Deploy Preview https://deploy-preview-647.muckcloud.com
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@eyeseast eyeseast marked this pull request as ready for review September 8, 2024 16:23
Comment on lines +84 to +109
<form method="post" action="/documents/projects/" use:enhance={onSubmit}>
<h2>{$_("projects.create")}</h2>
<Field title={$_("projects.fields.title")} required inline>
<Text name="title" placeholder={$_("projects.fields.title")} />
</Field>

<details>
<summary>{$_("common.more")} &hellip;</summary>
<Flex direction="column">
<Field title={$_("projects.fields.description")}>
<TextArea name="description" />
</Field>
<Field title={$_("projects.fields.private")} inline>
<Switch name="private" />
</Field>
<Field title={$_("projects.fields.pinned")} inline>
<Switch name="pinned" />
</Field>
</Flex>
</details>
<Flex>
<Button mode="primary" type="submit">
{$_("common.add")} +
</Button>
</Flex>
</form>
Copy link
Member

@allanlasser allanlasser Sep 11, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that this form belongs in its own modal:

  • Creating a new project is a focused and intentional interaction that waits on a server response, so it creates a new UI context. This points to a modal being the correct space for this interaction.
  • Creating a new project is a less common action when organizing documents. In this UI, we can assume the frequency of a user creating new projects is less than the frequency of picking existing projects.
  • Use of a <details> element speaks to the current UI feeling too "cluttered" with the full creation form, but I think this misplaces the disclosure of additional interaction. Instead of hiding individual inputs from users, we should hide the entire form until the user makes an intentional interaction to create a new project.
  • This project form has no opinion about the context it's rendered in, so it could appear in any kind of layout. This means we are not necessarily stacking modals inside one interface. Our current implementation of modals also supports layering, so the question is not "will this decision result in a nested modal?" but "is a modal the appropriate interaction in the context of this component?" In this case, the answer is yes. By reframing the question away from outcome and towards motivation, it allows us to think more critically about the use of a modal in the context of each component—the culmination of those decisions is a consisently behaved UI that's more coherent to users.

We also already have the EditProject component that defines this form, so I think reusing that instead of redefining it is the correct path here for ensuring consistency in creating projects going forward.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you're right, but I'm going to punt this to a separate issue/PR in favor of getting this merged sooner. I'll open an issue to refactor.

Copy link
Member

@allanlasser allanlasser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall looks great, most feedback is either flagging things for issues/follow-up work, or lightly refactoring. No huge changes.

Wanted to confirm that adding to projects from manager views is intentionally not a part of this PR? That's the only piece of "lifecycle" that seems missing.

@eyeseast eyeseast merged commit dd6146f into sveltekit Sep 11, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants