-
Notifications
You must be signed in to change notification settings - Fork 11
feat: APP-855 implement data posts table in dashboard projects #2810
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
Open
alexander-astrand
wants to merge
15
commits into
dev
Choose a base branch
from
feat-APP-855-implement-data-posts-table-in-dashboard-projects
base: dev
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 12 commits
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
b5e6ab9
feat: APP-855 scaffold data post table and fetching
alexander-astrand 919fc97
fix: linting error
alexander-astrand d76bb74
chore: translations
alexander-astrand 6948abb
fix: fetching increased, review comments and privacy settings icons +…
alexander-astrand 565c744
chore: translations
alexander-astrand 05de3d9
feat: implement edit and delete actions, refetch after post creation
alexander-astrand fb8bf1f
fix: lint and constanst duplicates
alexander-astrand b623e6d
chore: replace Box with div for data post table
alexander-astrand 6f7d392
fix: spacing for data post table
alexander-astrand df59f7c
fix: margings and padding
alexander-astrand def3f80
feat: isViewer check for action buttons
alexander-astrand 4df422c
feat: moved create post button to data posts table from project dashb…
alexander-astrand ee8abe5
fix: server side pagination/sorting, org dashboard tab routing, rever…
alexander-astrand 262859c
fix: review comments
alexander-astrand 548c1a6
fix: comment
alexander-astrand File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
37 changes: 37 additions & 0 deletions
37
web-marketplace/src/components/organisms/DataPostsTable/DataPostsTable.constants.ts
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,37 @@ | ||
| import { msg } from '@lingui/core/macro'; | ||
|
|
||
| export const DATA_POSTS_TABLE_LABEL = msg`data posts table`; | ||
|
|
||
| export const DATA_POSTS_TITLE = msg`Data Posts`; | ||
| export const DATA_POSTS_DESCRIPTION = msg`Upload data, provide updates, and anchor your information to the blockchain for full transparency and accountability.`; | ||
|
|
||
| export const EDIT_DRAFT_ACTION = msg`Edit Draft`; | ||
| export const DELETE_POST_ACTION = msg`Delete Post`; | ||
|
|
||
| export const PUBLIC_LABEL = msg`Public`; | ||
|
|
||
| /* eslint-disable lingui/no-unlocalized-strings */ | ||
| /** Column configuration for building sortCallbacks. | ||
| * Order must match the headerRows array in DataPostsTable. */ | ||
| export enum DATA_POSTS_HEADERS { | ||
| TITLE = 'title', | ||
| DATE_CREATED = 'dateCreated', | ||
| AUTHOR = 'author', | ||
| PRIVACY = 'privacy', | ||
| FILES = 'files', | ||
| } | ||
|
|
||
| export const DATA_POSTS_COLUMN_MAPPING: Record< | ||
| DATA_POSTS_HEADERS, | ||
| { sortKey: string; sortEnabled?: boolean } | ||
| > = { | ||
| [DATA_POSTS_HEADERS.TITLE]: { sortKey: 'title', sortEnabled: true }, | ||
| [DATA_POSTS_HEADERS.DATE_CREATED]: { | ||
| sortKey: 'createdAt', | ||
| sortEnabled: true, | ||
| }, | ||
| [DATA_POSTS_HEADERS.AUTHOR]: { sortKey: 'author', sortEnabled: true }, | ||
| [DATA_POSTS_HEADERS.PRIVACY]: { sortKey: 'privacy' }, | ||
| [DATA_POSTS_HEADERS.FILES]: { sortKey: 'filesCount' }, | ||
| }; | ||
| /* eslint-enable lingui/no-unlocalized-strings */ |
40 changes: 40 additions & 0 deletions
40
web-marketplace/src/components/organisms/DataPostsTable/DataPostsTable.sort.ts
This file contains hidden or 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| import { | ||
| createAscSortHandler, | ||
| createDescSortHandler, | ||
| } from 'lib/sort/createSortHandler'; | ||
|
|
||
| import { DataPost } from './DataPostsTable.types'; | ||
|
|
||
| export type DataPostsSortType = | ||
| | 'default' | ||
| | 'title-asc' | ||
| | 'title-desc' | ||
| | 'createdAt-asc' | ||
| | 'createdAt-desc' | ||
| | 'author-asc' | ||
| | 'author-desc'; | ||
|
|
||
| const asc = createAscSortHandler<DataPost>(); | ||
| const desc = createDescSortHandler<DataPost>(); | ||
|
|
||
| export const sortDataPosts = ( | ||
| posts: DataPost[], | ||
| sort: DataPostsSortType, | ||
| ): DataPost[] => { | ||
| switch (sort) { | ||
| case 'title-asc': | ||
| return posts.sort(asc('title')); | ||
| case 'title-desc': | ||
| return posts.sort(desc('title')); | ||
| case 'createdAt-asc': | ||
| return posts.sort(asc('createdAt')); | ||
| case 'createdAt-desc': | ||
| return posts.sort(desc('createdAt')); | ||
| case 'author-asc': | ||
| return posts.sort(asc('author')); | ||
| case 'author-desc': | ||
| return posts.sort(desc('author')); | ||
| default: | ||
| return posts; | ||
| } | ||
| }; |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.