-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'refs/heads/main' into app-dir
# Conflicts: # components/details/ComboDetails.jsx # components/details/FlatgroundTrickDetails.jsx # components/details/GrindDetails.jsx # components/details/ManualDetails.jsx # components/forms/ComboForm.jsx # components/forms/FlatgroundTrickForm.jsx # components/forms/GrindForm.jsx # components/forms/ManualForm.jsx # components/forms/ProfileForm.jsx # components/stats/Stats.jsx # lib/commonUtils.js # models/FlatgroundTrick.js # models/Grind.js # package-lock.json # package.json # pages/_dashboard.jsx # pages/api/combos/search/index.js # pages/api/profiles/mine/index.js # pages/combos/index.jsx # pages/flatgroundtricks/[_id]/edit.jsx # pages/flatgroundtricks/_index.jsx # pages/grinds/index.jsx # pages/manuals/index.jsx # pages/profile/index.jsx # tailwind.config.js
- Loading branch information
Showing
68 changed files
with
1,448 additions
and
558 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { capitalize } from '../../lib/commonUtils'; | ||
|
||
describe('capitalize', () => { | ||
it('should be able to capitalize one word', () => { | ||
expect(capitalize('ollie')).toBe('Ollie'); | ||
}); | ||
it('should be able to capitalize multiple words PascalCase style', () => { | ||
expect(capitalize('ollie Kickflip treflip', true)).toBe('Ollie Kickflip Treflip'); | ||
}); | ||
}); |
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,10 @@ | ||
function AddAnotherCheckBox({ checked, onChange }) { | ||
return ( | ||
<label title="Reset the form after creation"> | ||
<input type="checkbox" checked={checked} onChange={onChange} name="addAnother" className="h-4 w-4 align-middle" /> | ||
<span className="ml-2 align-middle">Add another</span> | ||
</label> | ||
); | ||
} | ||
|
||
export default AddAnotherCheckBox; |
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,41 @@ | ||
import { shallowEqual } from '../../lib/commonUtils'; | ||
import { ArrowPathIcon } from '@heroicons/react/20/solid'; | ||
import { useEffect, useRef, useState } from 'react'; | ||
import Accordion from '../../lib/accordion'; | ||
|
||
function Filters({ filters = {}, onReset, children }) { | ||
const [defaultFilters, setDefaultFilters] = useState(undefined); | ||
const detailsRef = useRef(null); | ||
|
||
useEffect(() => { | ||
if (!defaultFilters) setDefaultFilters(filters); | ||
|
||
if (detailsRef.current) { | ||
new Accordion(detailsRef.current); | ||
} | ||
}, []); | ||
|
||
return ( | ||
<details ref={detailsRef} className="rounded-lg bg-neutral-50 p-4 shadow-md dark:bg-neutral-800"> | ||
<summary className="cursor-pointer text-xl font-medium">Filters</summary> | ||
<div> | ||
{/* Mandatory content </div> for the Accordion component to work */} | ||
<hr className="my-4 border-neutral-800 dark:border-neutral-400" /> | ||
<div className="flex flex-wrap items-center gap-4"> | ||
{children} | ||
{!shallowEqual(filters, defaultFilters) && ( | ||
<button | ||
title="Reset filters" | ||
className="ml-auto p-2 transition-transform hover:scale-110 hover:duration-100 active:scale-95" | ||
onClick={onReset} | ||
> | ||
<ArrowPathIcon className="h-6 w-6" /> | ||
</button> | ||
)} | ||
</div> | ||
</div> | ||
</details> | ||
); | ||
} | ||
|
||
export default Filters; |
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,16 @@ | ||
import { useEffect, useState } from 'react'; | ||
import { formatDate } from '../../lib/commonUtils'; | ||
|
||
function RenderSafeDate({ date, options = {} }) { | ||
const [dateToRender, setDateToRender] = useState(null); | ||
|
||
useEffect(() => { | ||
setDateToRender(formatDate(date, options)); | ||
}, []); | ||
|
||
if (!dateToRender) return null; | ||
|
||
return <time>{dateToRender}</time>; | ||
} | ||
|
||
export default RenderSafeDate; |
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,9 @@ | ||
function Show({ if: condition, children }) { | ||
if (condition) { | ||
return children; | ||
} | ||
|
||
return null; | ||
} | ||
|
||
export default Show; |
Oops, something went wrong.