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

Projects: create useProjectDataProvider hook #363

Closed
tjcouch-sil opened this issue Aug 14, 2023 · 0 comments
Closed

Projects: create useProjectDataProvider hook #363

tjcouch-sil opened this issue Aug 14, 2023 · 0 comments
Assignees
Labels
extensions team Able to be worked on by extensions team

Comments

@tjcouch-sil
Copy link
Member

tjcouch-sil commented Aug 14, 2023

As an extension developer, I want to be able to get project data easily in React so I can easily make WebViews.


Create a hook useProjectDataProvider that retrieves a project with your specified project ID. Maybe this can be a thin layer over the useDataProvider hook? Or it will at least be quite similar.

  • Could we make a createProviderHook function that we pass the appropriate retrieval function into like dataProviderService.get and projectDataProvider.getProjectDataProvider? Not sure if all that code can be shared. That would be like const useDataProvider = createProviderHook(dataProviderService.get). So the current code in useDataProvider goes into createProviderHook, and createProviderHook(getProvider: (id) => Provider) returns a function that is the useDataProvider hook.

useProjectDataProvider will use a generic ProjectType extends ProjectTypes mapped type similar to project-data-provider.service.ts's getProjectDataProvider. You can almost think of it as a hook over that function.

Function signature:

function useProjectDataProvider<ProjectType extends ProjectTypes>(projectDataProviderSource: string | ProjectDataProvider[ProjectType] | undefined): ProjectDataProvider[ProjectType] | undefined;

Project Design Doc

Testing Note: Talk to Matt about how to load projects

@tjcouch-sil tjcouch-sil converted this from a draft issue Aug 14, 2023
@tjcouch-sil tjcouch-sil moved this to 📋Product Backlog in Paranext Aug 14, 2023
@tjcouch-sil tjcouch-sil added this to the Project Implementation: Phase 1 - PDPF milestone Aug 14, 2023
@GlennPruitt GlennPruitt moved this from Open to Product Backlog in Paranext Sep 27, 2023
@GlennPruitt GlennPruitt modified the milestones: Projects: Phase 1 - PDPF, Tech Demo Sep 28, 2023
@lyonsil lyonsil removed the PDPF label Sep 29, 2023
@katherinejensen00 katherinejensen00 added the extensions team Able to be worked on by extensions team label Oct 2, 2023
@katherinejensen00 katherinejensen00 moved this from Product Backlog to 🔖 ToDo in Paranext Oct 4, 2023
@katherinejensen00 katherinejensen00 moved this from 🔖 ToDo to 🏗 In progress in Paranext Oct 4, 2023
tombogle added a commit that referenced this issue Oct 6, 2023
…roject-name that needs to change. Loading project by id does not work yet.
@katherinejensen00 katherinejensen00 moved this from 🏗 In progress to 👀 In review in Paranext Oct 11, 2023
@katherinejensen00 katherinejensen00 moved this from 👀 In review to ✅ Done in Paranext Oct 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
extensions team Able to be worked on by extensions team
Projects
Status: ✅ Done
Development

No branches or pull requests

5 participants