-
Notifications
You must be signed in to change notification settings - Fork 6
SVA-444 update filters to new dropdown designs #219
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
mirkiy
wants to merge
16
commits into
develop
Choose a base branch
from
SVA-444-update-filters-to-new-dropdown-designs
base: develop
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 all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
8358841
search bar and heading in progress
mirkiy d02ea04
tag style buttons in progress
mirkiy 733c396
toggling icons within tags
mirkiy de3f8f6
new filter button and horizontal scrollview added
mirkiy bd4b93b
TagButtons component
mirkiy 5e8eb3c
scrolling fixed
mirkiy 974c603
search bar, filters, tagbuttons in progress
mirkiy 5ccc331
TagButtons and colours updated
mirkiy f780aef
roles filter in list container in progress
mirkiy 73d8b22
clear of the search results
mirkiy 9555d89
styling changes
mirkiy 23e7406
unused imports deleted
mirkiy 31cac5a
WIP next steps
dkaschl 58fe3d3
starting to work on little incrementations
dkaschl 3a55cb3
removing old pages, moving logic into listcontainer
dkaschl 698766c
handleQuickSearch passed as a prop, logic moved to ListContainer
mirkiy 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 was deleted.
Oops, something went wrong.
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,139 @@ | ||
| import { | ||
| Projects, | ||
| ProjectSector, | ||
| ProjectsSearchField, | ||
| ProjectTechnology, | ||
| } from '@/Services/modules/projects' | ||
| import { RoleGroupName } from '@/Services/modules/projects/roleGroups' | ||
| import { ProjectsState } from '@/Store/Projects' | ||
| import { VStack } from 'native-base' | ||
| import React, { FC, useState } from 'react' | ||
| import { useSelector } from 'react-redux' | ||
| import { ListSearch } from '../Containers/ListContainer' | ||
| import ChoicesList, { | ||
| ChoicesListChoice, | ||
| ChoicesListColour, | ||
| ChoicesListFontStyle, | ||
| } from './ChoicesList' | ||
| import TagButtons from './TagButtons' | ||
|
|
||
| export interface ProjectSearch extends ListSearch { | ||
| results: Projects // the projects results for this search | ||
| } | ||
| export interface ProjectsTagButtonsFilterProps { | ||
| handleQuickSearchSubmit: ( | ||
| searchField: ProjectsSearchField, | ||
| searchQueryChoice: string, | ||
| ) => void | ||
| } | ||
|
|
||
| const ProjectsTagButtonsFilter: FC<ProjectsTagButtonsFilterProps> = ({ | ||
| handleQuickSearchSubmit, | ||
| }) => { | ||
| // Fetch all projects from the store | ||
| const allProjects = useSelector( | ||
| (state: { projects: ProjectsState }) => state.projects.projects, | ||
| ) | ||
|
|
||
| // State to track the currently active tag (using simple strings) | ||
| const [activeTag, setActiveTag] = useState<string | null>(null) | ||
|
|
||
| // Define which quick search options to use | ||
| const quickSearchRoleGroupNames: RoleGroupName[] = [ | ||
| RoleGroupName.WebDeveloper, | ||
| RoleGroupName.TechSupport, | ||
| RoleGroupName.UIUX, | ||
| RoleGroupName.Researcher, | ||
| RoleGroupName.BAPM, | ||
| RoleGroupName.ScrumMaster, | ||
| ] | ||
| const quickSearchRoleChoices: ChoicesListChoice[] = | ||
| quickSearchRoleGroupNames.map( | ||
| roleGroupName => | ||
| ({ | ||
| text: roleGroupName, | ||
| onPress: () => | ||
| handleQuickSearchSubmit(ProjectsSearchField.Role, roleGroupName), | ||
| } as ChoicesListChoice), | ||
| ) | ||
|
|
||
| const quickSearchTechnologies: ChoicesListChoice[] = Object.values( | ||
| ProjectTechnology, | ||
| ).map( | ||
| technology => | ||
| ({ | ||
| text: technology, | ||
| onPress: () => | ||
| handleQuickSearchSubmit(ProjectsSearchField.Skills, technology), | ||
| } as ChoicesListChoice), | ||
| ) | ||
|
|
||
| const quickSearchCauses: ChoicesListChoice[] = Object.values( | ||
| ProjectSector, | ||
| ).map( | ||
| cause => | ||
| ({ | ||
| text: cause, | ||
| onPress: () => | ||
| handleQuickSearchSubmit(ProjectsSearchField.Sector, cause), | ||
| } as ChoicesListChoice), | ||
| ) | ||
|
|
||
| // Define colour and style to use for quick search options | ||
| const quickSearchListColour = ChoicesListColour.primary | ||
| const quickSearchListStyle = ChoicesListFontStyle.mediumLight | ||
|
|
||
| /** | ||
| * Handle tag press logic | ||
| * If the tag is already open, close it by setting activeTag to null. | ||
| * If a different tag is clicked, close the previous one and open the new one. | ||
| */ | ||
| const handleTagPress = (tag: string) => { | ||
| setActiveTag(activeTag === tag ? null : tag) | ||
| } | ||
|
|
||
| return ( | ||
| <VStack> | ||
| {/* Tag Buttons for Roles, Tech, and Causes */} | ||
| <TagButtons | ||
| tags={['Roles', 'Tech', 'Causes']} // String tags | ||
| iconState={{ | ||
| Roles: activeTag === 'Roles', | ||
| Tech: activeTag === 'Tech', | ||
| Causes: activeTag === 'Causes', | ||
| }} | ||
| handleTagPress={handleTagPress} // String type handler | ||
| /> | ||
| <VStack padding="2"> | ||
| {/* Show the list of role choices if Roles tab is active */} | ||
| {activeTag === 'Roles' && ( | ||
| <ChoicesList | ||
| choices={quickSearchRoleChoices} | ||
| colour={quickSearchListColour} | ||
| style={quickSearchListStyle} | ||
| /> | ||
| )} | ||
|
|
||
| {/* Show the list of technology choices if Tech tab is active */} | ||
| {activeTag === 'Tech' && ( | ||
| <ChoicesList | ||
| choices={quickSearchTechnologies} | ||
| colour={quickSearchListColour} | ||
| style={quickSearchListStyle} | ||
| /> | ||
| )} | ||
|
|
||
| {/* Show the list of causes if Causes tag is active */} | ||
| {activeTag === 'Causes' && ( | ||
| <ChoicesList | ||
| choices={quickSearchCauses} | ||
| colour={quickSearchListColour} | ||
| style={quickSearchListStyle} | ||
| /> | ||
| )} | ||
| </VStack> | ||
| </VStack> | ||
| ) | ||
| } | ||
|
|
||
| export default ProjectsTagButtonsFilter |
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| import React from 'react' | ||
| import { HStack, Icon, IconButton, Pressable, Text } from 'native-base' | ||
| import MaterialIcons from 'react-native-vector-icons/MaterialIcons' | ||
|
|
||
| interface TagButtonsProps { | ||
| tags: string[] // An array of tag names, e.g., ['Roles', 'Tech', 'Causes'] | ||
| iconState: Record<string, boolean> // A dynamic record that maps tags to boolean states | ||
| handleTagPress: (tag: string) => void // A function that takes any tag | ||
| } | ||
|
|
||
| const TagButtons: React.FC<TagButtonsProps> = ({ | ||
| tags, | ||
| iconState, | ||
| handleTagPress, | ||
| }) => { | ||
| return ( | ||
| <HStack space={2} alignItems="center"> | ||
| {tags.map(tag => ( | ||
| <Pressable | ||
| key={tag} | ||
| onPress={() => handleTagPress(tag)} | ||
| borderRadius={40} | ||
| pl={4} | ||
| pr={2} | ||
| py={2} | ||
| display="flex" | ||
| flexDirection="row" | ||
| alignItems="center" | ||
| justifyContent="center" | ||
| backgroundColor={iconState[tag] ? 'primary.20' : 'gray.100'} | ||
| borderColor={iconState[tag] ? 'primary.100' : 'transparent'} | ||
| borderWidth={1} | ||
| > | ||
| <Text color={iconState[tag] ? 'primary.100' : 'gray.500'}>{tag}</Text> | ||
| <IconButton | ||
| icon={ | ||
| <Icon | ||
| as={MaterialIcons} | ||
| name={ | ||
| iconState[tag] ? 'keyboard-arrow-up' : 'keyboard-arrow-down' | ||
| } | ||
| size={5} | ||
| color={iconState[tag] ? 'primary.100' : 'gray.500'} | ||
| /> | ||
| } | ||
| variant="outline" | ||
| _icon={{ color: 'gray.500' }} | ||
| onPress={() => handleTagPress(tag)} | ||
| /> | ||
| </Pressable> | ||
| ))} | ||
| </HStack> | ||
| ) | ||
| } | ||
|
|
||
| export default TagButtons | ||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd also extract a single tagbutton into it's own component. This component here (TagButtons) could be then just using those tagbutton components. Naming wise we could also name HTagButtons (H for horinzontal) but as we do have only one version currently I think FilterTagButtons would be a good name as it says that it's about tag buttons used for filtering.