![](https://content.presentermedia.com/content/animsp/00005000/5102/theater_curtains_open_border_PA_300_wht.gif) --- # [Bookbrooch](https://bookbrooch-c63z1ls62-samymasy.vercel.app/) - Y+M --- ## What we used - A - Nextjs (v12) - React, Reactform-hook - Firebase - Chakra-UI/CSS Modules - Cypress - dotenv - goodquotesapi - pos `[ 'Happiness', 'NN' ], [ 'intelligent', 'JJ' ]` - wordsapi (rapidapi) --- ## How we worked - M ---- ![](https://media.tenor.com/8lBwt31zKXMAAAAC/i-volunteer-tribute.gif) ---- ![](https://64.media.tumblr.com/9ee018aadb157ee6c1c22a8499f4afce/ee11d93e565ff3e7-7e/s500x750/1628159dcbdb5ed9436d135755533bbfa8e5df4f.gif) --- ## Code examples - M ![](https://i.imgur.com/JRkXCxh.png) ---- Step by step - get all quotes: ```javascript [ {}, {}, {}] ``` ---- Each quote object ```javascript { tags: ["Happiness", "Inspirational"] }, { tags: ["Motivational", "Happiness"] }, { tags: ["Funny", "Happiness"] } ``` ---- - extract their tags into an array ```javascript userQuotes.forEach(quote => tags.push(quote.tags)) // Log: [ "Happiness", "Happiness", "Funny", "Inspirational", "Funny" ] ``` ---- - Create new object containing tag: how many times used ```javascript tags.forEach(element => { countKeysUsed[element] = (countKeysUsed[element] || 0) + 1; }); // Log: `{Wisdom: 3, Inspirational: 2, Life: 1}` ``` ---- - Find highest number of used - If tie - add all to an array ```javascript Object.keys(object).forEach(tag => { let freq = object[tag] if (!same[freq]) same[freq] = [] same[freq].push(tag) }) return same[maxPointsForTag] // Log `[Wisdom, Inspirational]` ``` ---- ![](https://media1.giphy.com/media/26u4lOMA8JKSnL9Uk/giphy.gif?cid=ecf05e47cvm73chw9ej04ad5bvm77jse5lvhf9834dsmjzgs&rid=giphy.gif&ct=g) --- ### Users can tag quotes -A ```javascript {user && home && ( <form onSubmit={handleSubmit(onSubmit)}> <input name="quote" value={quote} hidden {...register("quote")} /> <input name="author" value={author} hidden {...register("author")} /> <input name="source" value={source} hidden {...register("source")} /> <Select id="tagToChoseFrom" name="tags" {...register("tags")}> <option value="Inspirational">Inspirational</option> <option value="Happiness">Happiness</option> <option value="Wisdom">Wisdom</option> <option value="Funny">Funny</option> <option value="Career/professional">Career/professional</option> </Select> <Button type="submit" minH="30px"> Save </Button> </form> )} ``` --- ## What we're proud of ---- ### UI -A Previously ![](https://i.imgur.com/wQKjZMI.png) ---- Currently ![](https://i.imgur.com/Ozs4wYG.png) ---- ### Dark Mode using Chakra-UI -S ```javascript import { useColorMode, IconButton } from "@chakra-ui/react"; import { MoonIcon, SunIcon } from "@chakra-ui/icons"; const DarkModeSwitch = () => { const { colorMode, toggleColorMode } = useColorMode(); return ( <IconButton aria-label="Toggle Dark Switch" icon={colorMode === "dark" ? <SunIcon /> : <MoonIcon />} onClick={toggleColorMode} /> ); }; export default DarkModeSwitch; ``` ---- ### Cypress custom commands to test Firebase auth - S ```javascript Cypress.Commands.add( "login", (email = "test@test.com", password = "password") => { // programmatically log in without needing the UI return signInWithEmailAndPassword(auth, email, password); } ); // We can call this fn anywhere in our test like: cy.login(); or cy.login(email, password); ``` --- ## What we struggled with ---- ### Vercel depolyment -Y One letter!!! ![](https://i.imgur.com/C09pepz.png) --- ## Estimated vs Actual - S --- ![](https://i.gifer.com/DnUm.gif) --- |Issue |Estimated Velocity|Actual Velocity |-----|--------|------ |Search|E8 |A8 |Games|E5 |A18 |Tags|E1|A1 |Badges|E13|A5 |Styling|E5|A13 |mode |E2 |A1 Total | E34 | A46 --- ![](https://i.imgur.com/W5H2t2d.png) --- ### Thank you!!!!!!!!!!!! ![](https://i.imgur.com/pZU1zqM.png)
{"metaMigratedAt":"2023-06-17T14:47:54.956Z","metaMigratedFrom":"Content","title":"[Bookbrooch](https://bookbrooch-c63z1ls62-samymasy.vercel.app/) - Y+M","breaks":true,"contributors":"[{\"id\":\"bcf1b8f1-7115-4db4-8670-fbad5797945d\",\"add\":1069,\"del\":633},{\"id\":\"85bf9bcd-3fb6-4c9b-8a84-7f44e1efe568\",\"add\":3992,\"del\":1748},{\"id\":\"af673618-8798-403d-b3c5-797528522d82\",\"add\":2521,\"del\":1849},{\"id\":\"a39a5cc6-168d-44c7-9860-65c732cfa946\",\"add\":1843,\"del\":1004}]"}
    185 views
   Owned this note