Skip to content

Allow Resources to be saved as drafts#19

Open
cheapscate7 wants to merge 19 commits intoaberonni:mainfrom
cheapscate7:feature/drafts
Open

Allow Resources to be saved as drafts#19
cheapscate7 wants to merge 19 commits intoaberonni:mainfrom
cheapscate7:feature/drafts

Conversation

@cheapscate7
Copy link
Copy Markdown

implements #18

Adds "drafts" as a "pre-step" to the current resource workflow, ie, only non-submitted resources can be drafted.

Adds "delete by ID" tool in admin resource approval to help with removing abandoned drafts

Ramona Harrison added 2 commits February 5, 2024 17:36
create resoucevisibilty enum

add resource visibilty as field on Resource model

add draft resources to User Model

remove draftResources from User Model

made skeleton to view draft resources in profile

view published resources

Change ResourceVisibility.PUBLIC to ResourceVisibility.PUBLISHED

add button to save as draft, changed draft to be a boolean in prisma

remove unused import

disallow published resources from being drafts

fixed bug where proposed resources didnt show

fixed bug where editing a draft would propose an update instead of just saving

changed published to submitted in my-proposed-resources

Pretty-fied tabs in my-proposed-resources

add warning for resource id

add admin tool to delete resource by ID

clean up after rebase
@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 8, 2024

Someone is attempting to deploy a commit to a Personal Account owned by @aberonni on Vercel.

@aberonni first needs to authorize it.

@cheapscate7 cheapscate7 changed the title Feature/drafts Allow Resources to be saved as drafts Feb 8, 2024
@vercel
Copy link
Copy Markdown

vercel Bot commented Feb 9, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
improvdb ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 9, 2024 10:04am

Copy link
Copy Markdown
Owner

@aberonni aberonni left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution! This is really cool.

I've added a few comments here and there, but after seeing it in practice I've actually thought up a process that I think I would prefer to this one. I'm gonna outline it here, but you don't have to implement it if you're not up for it. I'm happy to run with it based on your proposal. Lemme know what you think.

  • When a user hits "propose new resource", they first see a dialog where they are prompted to enter title and URL
  • After submitting the title and URL, we create the resource in the backend (with publicationStatus: DRAFT), and redirect the user to the "edit" form (so the "create" page does not exist anymore)
  • In the "edit" form
    • We leave the "Save" button but we also add a "Submit for review" button
    • We update the alert to explain that you can save as much as you like before submitting for review. Once you hit "submit for review", you can't edit or save anymore
    • When the user hits "Submit for review", we simply switch to publicationStatus: READY_FOR_REVIEW

This would also open up the possibility in the future to fetch similar resources from the backend after the first step (the title dialog) and say "Are you maybe trying to re-create an existing resource?" and show the alternative resources. I wouldn't do this in the first run, but it's an idea.

I think this would make for a smoother, easier to understand UX, and also reduce the amount of complexity we need to add in the codebase. What do you think?

Comment thread prisma/schema.prisma Outdated
Comment thread prisma/schema.prisma Outdated
Comment thread src/pages/admin/pending-publication.tsx Outdated
Comment thread src/pages/resource/[id].tsx Outdated
Comment thread src/pages/user/my-proposed-resources.tsx Outdated
Comment thread src/server/api/routers/resource.ts Outdated
@cheapscate7
Copy link
Copy Markdown
Author

@aberonni I perfer your proposal workflow. My Idea originally was just for it to not touch too much of what was already there (hence being a "pre"-step) but your way is much more efficient. I didn't want to respond until I'd had the chance to try it out but I ended up making an implementation in the process so let me know what you think

Copy link
Copy Markdown
Owner

@aberonni aberonni left a comment

Choose a reason for hiding this comment

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

I didn't dig deep into the implementation because it seems that things still need to be addressed (eg. CI failures, and still some dead code from the previous implementation) so I assume this is still a WIP. That said, I love the new direction and would love to see it through to completion!

I imagine it would be easier for you to test with a real DB. If you hit me up (eg. on LinkedIn) I'd be happy to give you access to a development db with a copy of production data so you can test this more easily, and so that we can get a migration in place on planetscale before eventually merging.

Comment thread prisma/schema.prisma Outdated
@@ -1,4 +1,4 @@
import { useEffect, useMemo, useState } from "react";
import React, { useEffect, useState } from "react";
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

If I'm not mistaken, all the changes in this file can be reverted because the new dialog isn't being used anymore.

Comment thread src/components/resource-create-form.tsx Outdated
Comment thread src/components/resource-create-form.tsx
Comment thread src/components/resource-create-form.tsx Outdated
Comment thread src/pages/resource/[id]/clone.tsx
Comment thread src/pages/resource/[id]/edit.tsx Outdated
Comment thread src/pages/user/my-proposed-resources.tsx Outdated
Comment thread src/server/api/routers/resource.ts Outdated
@cheapscate7
Copy link
Copy Markdown
Author

Thanks! yes, I wanted to get your opinion first to make sure I understood what your suggestion was as I dont have a lot of time in the coming days.
Ive already addressed some of your comments but I will have to get around to some of the other stuff like migrations In a bit

@aberonni
Copy link
Copy Markdown
Owner

Yeah there's no rush at all so you can take your time. If you'd prefer me to take it on from here that's also fine. Just let me know either way. If you do decide to keep at it, ping me elsewhere so I can give you access to a dev DB branch.

Ramona Harrison added 7 commits February 29, 2024 15:01
create resoucevisibilty enum

add resource visibilty as field on Resource model

add draft resources to User Model

remove draftResources from User Model

made skeleton to view draft resources in profile

view published resources

Change ResourceVisibility.PUBLIC to ResourceVisibility.PUBLISHED

add button to save as draft, changed draft to be a boolean in prisma

remove unused import

disallow published resources from being drafts

fixed bug where proposed resources didnt show

fixed bug where editing a draft would propose an update instead of just saving

changed published to submitted in my-proposed-resources

Pretty-fied tabs in my-proposed-resources

add warning for resource id

add admin tool to delete resource by ID

clean up after rebase
Ramona Harrison added 2 commits March 11, 2024 17:10
fix next step button

separate create and update resource schemas
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