-
Notifications
You must be signed in to change notification settings - Fork 17
fix: create icon_paths field for communities
#410
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
Merged
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
ecb90b8
fix: create `icon_paths` field for communities
suprstarrd 9b58aae
fix(ui): make icon_paths not required in the model
suprstarrd dbfe087
fix(api): add icon_paths to model
suprstarrd 0ed5d4c
Merge remote-tracking branch 'upstream/dev' into fix/subcommunity-icons
suprstarrd 0720b59
merge: add icon_paths to communities.ts
suprstarrd 7bfb00c
fix: add icon_paths to community update (plus a little extra typesafety)
mrjvs 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 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
5 changes: 2 additions & 3 deletions
5
apps/juxtaposition-ui/src/services/juxt-web/views/ctr/communityListView.tsx
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
21 changes: 21 additions & 0 deletions
21
apps/juxtaposition-ui/src/services/juxt-web/views/ctr/components/ui/CtrCommunityIcon.tsx
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,21 @@ | ||
| import { CtrIcon } from '@/services/juxt-web/views/ctr/components/ui/CtrIcon'; | ||
| import { useUrl } from '@/services/juxt-web/views/common/hooks/useUrl'; | ||
| import type { ReactNode } from 'react'; | ||
| import type { CommunityIconProps } from '@/services/juxt-web/views/web/components/ui/WebCommunityIcon'; | ||
|
|
||
| export function CtrCommunityIcon(props: CommunityIconProps): ReactNode { | ||
| const url = useUrl(); | ||
| const imageId = props.community.parent ? props.community.parent : props.community.olive_community_id; | ||
| const iconUrl = props.community.icon_paths ? url.cdn(props.community.icon_paths[props.size]) : url.cdn(`/icons/${imageId}/${props.size}.png`); | ||
| const href = `/communities/${props.community.community_id}`; | ||
|
|
||
| return ( | ||
| <CtrIcon | ||
| href={href} | ||
| src={iconUrl} | ||
| type="icon" | ||
| className={props.className} | ||
| > | ||
| </CtrIcon> | ||
| ); | ||
| } |
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
6 changes: 2 additions & 4 deletions
6
apps/juxtaposition-ui/src/services/juxt-web/views/portal/communityListView.tsx
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
21 changes: 21 additions & 0 deletions
21
...juxtaposition-ui/src/services/juxt-web/views/portal/components/ui/PortalCommunityIcon.tsx
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,21 @@ | ||
| import { PortalIcon } from '@/services/juxt-web/views/portal/components/ui/PortalIcon'; | ||
| import { useUrl } from '@/services/juxt-web/views/common/hooks/useUrl'; | ||
| import type { ReactNode } from 'react'; | ||
| import type { CommunityIconProps } from '@/services/juxt-web/views/web/components/ui/WebCommunityIcon'; | ||
|
|
||
| export function PortalCommunityIcon(props: CommunityIconProps): ReactNode { | ||
| const url = useUrl(); | ||
| const imageId = props.community.parent ? props.community.parent : props.community.olive_community_id; | ||
| const iconUrl = props.community.icon_paths ? url.cdn(props.community.icon_paths[props.size]) : url.cdn(`/icons/${imageId}/${props.size}.png`); | ||
| const href = `/communities/${props.community.community_id}`; | ||
|
|
||
| return ( | ||
| <PortalIcon | ||
| href={href} | ||
| src={iconUrl} | ||
| type="icon" | ||
| className={props.className} | ||
| > | ||
| </PortalIcon> | ||
| ); | ||
| } |
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
28 changes: 28 additions & 0 deletions
28
apps/juxtaposition-ui/src/services/juxt-web/views/web/components/ui/WebCommunityIcon.tsx
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,28 @@ | ||
| import { WebIcon } from '@/services/juxt-web/views/web/components/ui/WebIcon'; | ||
| import { useUrl } from '@/services/juxt-web/views/common/hooks/useUrl'; | ||
| import type { ReactNode } from 'react'; | ||
| import type { InferSchemaType } from 'mongoose'; | ||
| import type { CommunitySchema } from '@/models/communities'; | ||
|
|
||
| export type CommunityIconProps = { | ||
| community: InferSchemaType<typeof CommunitySchema>; | ||
| size: '32' | '48' | '64' | '96' | '128'; | ||
| className?: string; | ||
| }; | ||
|
|
||
| export function WebCommunityIcon(props: CommunityIconProps): ReactNode { | ||
| const url = useUrl(); | ||
| const imageId = props.community.parent ? props.community.parent : props.community.olive_community_id; | ||
| const iconUrl = props.community.icon_paths ? url.cdn(props.community.icon_paths[props.size]) : url.cdn(`/icons/${imageId}/${props.size}.png`); | ||
| const href = `/communities/${props.community.community_id}`; | ||
|
|
||
| return ( | ||
| <WebIcon | ||
| href={href} | ||
| src={iconUrl} | ||
| type="icon" | ||
| className={props.className} | ||
| > | ||
| </WebIcon> | ||
| ); | ||
| } |
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.
Uh oh!
There was an error while loading. Please reload this page.