-
Notifications
You must be signed in to change notification settings - Fork 0
Implement Volunteer Table Sort Modal #117
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
a1-su
wants to merge
27
commits into
main
Choose a base branch
from
frontend/volunteer-table-sort-modal
base: main
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.
+397
−126
Open
Changes from 23 commits
Commits
Show all changes
27 commits
Select commit
Hold shift + click to select a range
f5814c0
Implemented getVolunteersTable API function
99a5340
Export getVolunteersTable in API index
b3ef3f6
Implemented testing for getVolunteersTable API function
3095b60
Merge branch 'backend/get-volunteers-table-api' into frontend/volunte…
a1-su 5494b9d
Implement Volunteer Table main functionality
a1-su c82ba8e
Merge branch 'main' into frontend/volunteer-table
a1-su ea67fea
Implement Volunteer Table Modal
a1-su e30bfd4
Fix table columns and search
a1-su 58558c3
Merge branch 'frontend/volunteer-table' into frontend/volunteer-table…
a1-su f97ff1d
Fix formatting color error
a1-su 1fea410
Refactor table to include opt in communication
a1-su 45b9516
Modify volunteer table imports
a1-su 39c8f8a
Merge branch 'frontend/volunteer-table' into frontend/volunteer-table…
a1-su da17054
Fix icon sizing
a1-su d93bbe4
Fix icon sizing
a1-su d4bc46e
Table optimizationa nd aria labels
a1-su 6137a60
Merge branch 'frontend/volunteer-table' into frontend/volunteer-table…
a1-su 49aa6cc
Merge branch 'main' into frontend/volunteer-table-filter-modal
a1-su 182a802
Fix row filtering selection bug and imports
a1-su 1e35372
Fix searchbar styling
a1-su 05e7b31
Fix opt_in_communication column type and add proper tests
a1-su d667298
Implement sort modal
a1-su 352be37
Merge branch 'main' into frontend/volunteer-table-sort-modal
a1-su aa0dfc7
Fix variable color names
a1-su 901ba3f
Fix admin account info page color names
a1-su a4ecb3e
something
notjackl3 46f08cd
Merge branch 'main' into frontend/volunteer-table-sort-modal
notjackl3 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,72 @@ | ||
| import React, { useState, useRef, useEffect } from "react"; | ||
|
|
||
| export interface SelectorColumn { | ||
| id: string; | ||
| label: string; | ||
| icon: React.ElementType; | ||
| } | ||
|
|
||
| interface ColumnSelectorProps { | ||
| columns: SelectorColumn[]; | ||
| onSelect: (colId: string) => void; | ||
| placeholder?: string; | ||
| } | ||
|
|
||
| export const ColumnSelector = ({ | ||
| columns, | ||
| onSelect, | ||
| placeholder = "Select column...", | ||
| }: ColumnSelectorProps): React.JSX.Element => { | ||
| const [search, setSearch] = useState(""); | ||
| const inputRef = useRef<HTMLInputElement>(null); | ||
|
|
||
| useEffect(() => { | ||
| setTimeout(() => inputRef.current?.focus(), 0); | ||
| }, []); | ||
|
|
||
| const visibleColumns = columns.filter((col) => | ||
| col.label.toLowerCase().includes(search.toLowerCase()) | ||
| ); | ||
|
|
||
| return ( | ||
| <> | ||
| <input | ||
| ref={inputRef} | ||
| type="text" | ||
| placeholder={placeholder} | ||
| value={search} | ||
| onChange={(e) => setSearch(e.target.value)} | ||
| onKeyDown={(e) => { | ||
| if (e.key === "Enter") { | ||
| e.preventDefault(); | ||
| if (visibleColumns.length > 0 && visibleColumns[0]) { | ||
| onSelect(visibleColumns[0].id); | ||
| } | ||
| } | ||
| }} | ||
| className="w-full bg-gray-50 border border-gray-200 rounded-md px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-secondary-purple" | ||
| /> | ||
| <div className="flex flex-col max-h-60 overflow-y-auto mt-2"> | ||
| {visibleColumns.length > 0 ? ( | ||
| visibleColumns.map((col) => { | ||
| const Icon = col.icon; | ||
| return ( | ||
| <button | ||
| key={col.id} | ||
| onClick={() => onSelect(col.id)} | ||
| className="text-left px-3 py-2 text-sm text-gray-700 hover:bg-gray-50 rounded-md transition-colors flex items-center gap-2" | ||
| > | ||
| <Icon className="w-4 h-4 text-gray-400 shrink-0" /> | ||
| <span>{col.label}</span> | ||
| </button> | ||
| ); | ||
| }) | ||
| ) : ( | ||
| <p className="text-xs text-gray-500 italic p-2 text-center"> | ||
| No available columns | ||
| </p> | ||
| )} | ||
| </div> | ||
| </> | ||
| ); | ||
| }; | ||
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
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.