-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Request a Concert and Dance Club forms (#77)
* add time slot component * adjust validation (TODO: maximum start time (5 pm)) * add MultiSelect component * make slot component compatible with question state * add on layout and make slots work with state and not state.value * fix styling, add questions.js * add questions for all forms, refractor them into index.js, and add request concert form screen navigate (todo: fix cannot read property map of undefined when request concert button pressed) * Add support for Request Concert and Dance Club. Note that as of right now they are in the volunteer forms spreadsheet, not yet a button in other opportunities * Fix Bugs * Make 4 favorite music pieces question in dance club form a list of 4 input boxes. Bugs: validation (only for this form, probably this specific question), margin 20 instead of 0 * make submit forms concise * merge more * add request concert and dance club functionality to other opportunities * fix checkboxquery, fixing favoritePieces question in dance form attempt 1 * 'bout to do pr * styling * do requested changes * formatting * fix MultipleChoice component showing indices only, now shows actual content (performanceType dynamic changing still works) * ```npm run format```-ing * Refactor forms into files & fix multiple bugs - Fix circular dependency errors - Fix LMH/MBT time limit validation - Align with OOP by refactoring common methods into the base Form class * Clean up (minor readability improvements) - Remove unused imports - Organize imports - Add required indicator to the RequestConcert time slot - Rename Slot -> TimeSlotList to prevent ambiguity --------- Co-authored-by: TenType <55125103+TenType@users.noreply.github.com>
- Loading branch information
Showing
35 changed files
with
1,627 additions
and
572 deletions.
There are no files selected for viewing
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
import MaterialCommunityIcons from "@expo/vector-icons/MaterialCommunityIcons"; | ||
import { useState } from "react"; | ||
import { Pressable, StyleSheet, Text, View } from "react-native"; | ||
|
||
export default function MultiSelect({ state, setState, title, options }) { | ||
const [selected, setSelected] = useState( | ||
new Array(options.length).fill(false), | ||
); | ||
|
||
return ( | ||
<View | ||
onLayout={(event) => { | ||
setState((prevState) => ({ | ||
...prevState, | ||
y: event.nativeEvent.layout.y, | ||
})); | ||
}} | ||
style={styles.container} | ||
> | ||
<Text style={[styles.title, { color: state.valid ? "black" : "red" }]}> | ||
{title} | ||
</Text> | ||
{options.map((option, index) => ( | ||
<Pressable | ||
key={index * 4} | ||
onPress={() => { | ||
setState((previous) => { | ||
const newValue = selected[index] | ||
? previous.value.filter((item) => item !== option) | ||
: [...previous.value, option]; | ||
return { ...previous, value: newValue }; | ||
}); | ||
|
||
setSelected((previous) => { | ||
const next = [...previous]; // Create a new copy of the array | ||
next[index] = !previous[index]; | ||
return next; | ||
}); | ||
}} | ||
> | ||
<View key={index * 4 + 1} style={{ flexDirection: "row" }}> | ||
<MaterialCommunityIcons | ||
key={index * 4 + 2} | ||
name={ | ||
selected[index] ? "checkbox-marked" : "checkbox-blank-outline" | ||
} | ||
size={24} | ||
color={selected[index] ? "blue" : "black"} | ||
/> | ||
<Text key={index * 4 + 3} style={styles.optionText}> | ||
{option} | ||
</Text> | ||
</View> | ||
</Pressable> | ||
))} | ||
</View> | ||
); | ||
} | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
marginBottom: 20, | ||
}, | ||
|
||
title: { | ||
fontSize: 18, | ||
fontWeight: "600", | ||
marginBottom: 10, | ||
flexWrap: "wrap", | ||
}, | ||
|
||
optionText: { | ||
fontSize: 16, | ||
marginLeft: 10, | ||
flexWrap: "wrap", | ||
}, | ||
}); |
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
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
Oops, something went wrong.