This repository has been archived by the owner on Jan 16, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## what - add package `@tanstack/react-table` ## how ## why - will be used shadcn-ui `Table` to make a more complex table ## where - ./package-lock.json - ./package.json ## usage
## what - add component `DataTable` ## how - obtained from - https://ui.shadcn.com/docs/components/data-table#datatable--component ## why - this component was designed for one use, but this component will be used in multiple pages, so it makes sense to place it `src/components/ui/` - check end of section of the link above ## where - ./src/components/ui/data-table.tsx ## usage
## what - add columns properties for `DataTable` component - define which columns to display on the DataTable ## how - check - https://ui.shadcn.com/docs/components/data-table#column-definitions ## why - this will determine which columns to display ## where - ./src/app/problems/components/data-table/columns.tsx ## usage
## what - add react-query hook to fetch all problems ## how - fetch from api endpoint `/api/problems` ## why ## where - ./src/hooks/index.ts ## usage
## what - display all problems using `DataTable` component ## how - using component `DataTable` - check - https://ui.shadcn.com/docs/components/data-table ## why - the `DataTable` will later be changed to be able to - search by problem number or problem title - add problem to favourites - remove problem to favourites - view/hide columns - add pagination ## where - ./src/app/problems/page.tsx ## usage
## what - add pagination to `DataTable` component ## how - check - https://ui.shadcn.com/docs/components/data-table#pagination ## why - to not load the a huge list of elements at once - lighter on memory ## where - ./src/components/ui/data-table.tsx ## usage
## what - add column scrolling to `DataTable` component ## how - check - https://ui.shadcn.com/docs/components/data-table#sorting ## why - allows a column to be sorted ## where - ./src/components/ui/data-table.tsx ## usage
…mponent ## what - add column properties to be sortable `DataTable` component ## how - check - https://ui.shadcn.com/docs/components/data-table#make-header-cell-sortable ## why - to have the ability to sort the table as you please ## where - ./src/app/problems/components/data-table/columns.tsx ## usage
## what - add column visibility toggle for `DataTable` component ## how - check - https://ui.shadcn.com/docs/components/data-table#visibility ## why - this will allow the usage of toggling columns visibility ## where - ./src/components/ui/data-table.tsx ## usage
## what - add package `@radix-ui/react-icons` ## how ## why ## where - ./package-lock.json - ./package.json ## usage
## what - add component `Select` ## how - run command npx shadcn-ui@latest add select ## why ## where - ./package-lock.json - ./package.json - ./src/components/ui/select.tsx ## usage
## what - add `DataTablePagination` component ## how - obtained from - https://github.com/shadcn-ui/ui/blob/main/apps/www/app/examples/tasks/components/data-table-pagination.tsx ## why - the table pagination is getting complicated, so it's better to move it to it's own file ## where - ./src/components/ui/data-table/pagination.tsx ## usage
…component ## what - use component `DataTablePagination` in `DataTable` component ## how - obtained from - https://github.com/shadcn-ui/ui/blob/main/apps/www/app/examples/tasks/components/data-table.tsx#L123 ## why - the table pagination is getting complicated, so it's better to move it to it's own file ## where - ./src/components/ui/data-table.tsx ## usage
…dex.tsx` ## what - move `DataTable` to `./src/components/ui/data-table/index.tsx` ## how ## why - place data-table related to it's own folder ## where - ./src/components/ui/data-table.tsx -> ./src/components/ui/data-table/index.tsx ## usage
…/problems` ## what - add a Link to the problem page in `DataTable` for `/problems` ## how ## why - need to be able to go the problem page for a specific problem number ## where - ./src/app/problems/components/data-table/columns.tsx ## usage
## what - use `Problem` as a type in DataTable columns ## how ## why - was using incorrect type for the column ## where - ./src/app/problems/components/data-table/columns.tsx ## usage
## what - format code ## how ## why ## where - ./src/app/problems/components/data-table/columns.tsx ## usage
## what - add component `Input` ## how - run command npx shadcn-ui@latest add input ## why ## where - ./src/components/ui/input.tsx ## usage
## what - add ability to filter any column in `DataTable` component ## how - obtained from - https://youtu.be/ZG2_vPlQA8Q?si=4AvVNavj5ih1A8tQ ## why - this will allow the ability to filter by any column ## where - ./src/components/ui/data-table/index.tsx ## usage
## what - add button to clear filter ## how ## why ## where - ./src/components/ui/data-table/index.tsx ## usage
## what - add icon in DataTable `columns` dropdown - add dropdown separator when opening the dropdown ## how ## why - better looking ## where - ./src/components/ui/data-table/index.tsx ## usage
## what - use custom string in DataTable dropdown ## how - add custom property `meta` in columns.tsx - check https://tanstack.com/table/v8/docs/api/core/column-def#meta ## why - add better string to display in dropdown - before it was displaying the column ID ## where - ./src/app/problems/components/data-table/columns.tsx - ./src/components/ui/data-table/index.tsx ## usage
## what - display link as a button ## how ## why - makes it more apparent that there is a link available ## where - ./src/app/problems/components/data-table/columns.tsx ## usage
## what - add page title ## how ## why ## where - ./src/app/problems/page.tsx ## usage
## what - display total number of items in the DataTable ## how ## why - to give the user an idea how many items are there in a table ## where - ./src/components/ui/data-table/pagination.tsx ## usage
## what - add column header component for DataTable - sort column - ascending - descending - default (sort by it's original order) - hide column ## how - obtained from - https://github.com/shadcn-ui/ui/blob/main/apps/www/app/examples/tasks/components/data-table-column-header.tsx ## why - this will be used by DataTable to render a more advanced column header - this is opt-in - this can only be used in a `column.tsx` file - check - https://github.com/shadcn-ui/ui/blob/fb614ac2921a84b916c56e9091aa0ae8e129c565/apps/www/app/examples/tasks/components/columns.tsx#L38-L46C4 ## where - ./src/components/ui/data-table/column-header.tsx ## usage
…r column header ## what - use `DataTableColumnHeader` to render column header ## how ## why - this will add a more advanced form of column header options - sort column - ascending - descending - default - hide column ## where - ./src/app/problems/components/data-table/columns.tsx ## usage
## what - remove unused code ## how ## why ## where - ./src/app/problems/page.tsx ## usage
## what - disable word-wrapping for pagination number - show `Page 'i' of 'x'` in the same line ## how ## why ## where - ./src/components/ui/data-table/pagination.tsx ## usage
## what - add loading component for DataTable ## how ## why - will be used to display when fetching data ## where - ./src/components/ui/data-table/loading.tsx ## usage
## what - add css classnames - nav-link - highlight the link on hover - active-nav-link - highlight the link. (used when the link and current page are the same) ## how ## why - these two nav-links will be used in `Navbar` component to - highlight a link on hover - highlight a link when the current path url is the same as the nav link url ## where - ./src/app/globals.css ## usage
## what - add navbar link to `/problems` page ## how ## why ## where - ./src/components/navbar.tsx ## usage
## what - highlight active links ## how - use css classname from `globals.css` - nav-link - highlight link on hover - active-nav-link - highlight link when link href is the same as the url pathname ## why ## where - ./src/components/navbar.tsx ## usage
## what - display a loading component for `/problems` page ## how ## why ## where - ./src/app/problems/page.tsx ## usage
## what - add a screenshot of `/problems` page - loading - data loaded ## how ## why ## where - ./docs/images/page-problems-loading.png - ./docs/images/page-problems.png ## usage
## what - display screenshots of `/problems` page - loading - data loaded ## how ## why ## where - ./README.md ## usage
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
🎉 This PR is included in version 1.0.0-development.3 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
/problems
Description
react-query
DataTable
/problems
link to navbarRelated Issue
#59
Motivation and Context
To display all problems in a page
To display in a table in order to be more efficient with memory
How Has This Been Tested?
Screenshots (if appropriate)
Types of changes
Does this Pull Request introduce a breaking change?
Checklist