-
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.
Make the community page more user friendly
- Loading branch information
Showing
10 changed files
with
117 additions
and
42 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,23 @@ | ||
'use client'; | ||
|
||
import {useCreateCommunity} from '@/lib/community/hooks'; | ||
import {useTranslations} from 'next-intl'; | ||
|
||
export function AddCommunityButton() { | ||
const {openCreateCommunity} = useCreateCommunity(); | ||
const t = useTranslations('Communities'); | ||
|
||
return ( | ||
<button | ||
onClick={() => | ||
openCreateCommunity({ | ||
afterCreateOrganizationUrl: organization => | ||
`/revalidate/?path=/[locale]/communities&redirect=/communities/${organization.slug}`, | ||
}) | ||
} | ||
className="p-1 sm:py-2 sm:px-3 rounded-full text-xs bg-neutral-200/50 hover:bg-neutral-300/50 text-neutral-800 transition flex items-center gap-1" | ||
> | ||
{t('addCommunity')} | ||
</button> | ||
); | ||
} |
23 changes: 23 additions & 0 deletions
23
apps/researcher/src/app/[locale]/communities/my-community-toggle.tsx
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,23 @@ | ||
'use client'; | ||
|
||
import {useListStore} from '@colonial-collections/list-store'; | ||
|
||
// A checked checkbox will set the filter 'onlyMyCommunities' to the string 'true'. | ||
// The value must be a string so the list updater can place it into the search params. | ||
export function MyCommunityToggle() { | ||
const filterChange = useListStore(s => s.filterChange); | ||
|
||
return ( | ||
<input | ||
type="checkbox" | ||
id="onlyMy" | ||
name="onlyMy" | ||
onChange={event => | ||
filterChange( | ||
'onlyMyCommunities', | ||
event.target.checked ? 'true' : undefined | ||
) | ||
} | ||
/> | ||
); | ||
} |
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
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