Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/app/[locale]/(groups)/groups/[id]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
import DivisionGroupService from '@/services/divisionGroupService';
import GammaService from '@/services/gammaService';
import style from './page.module.scss';
Expand All @@ -10,6 +10,7 @@
import ContactCard from '@/components/ContactCard/ContactCard';
import i18nService from '@/services/i18nService';
import ActionLink from '@/components/ActionButton/ActionLink';
import GroupAvatar from '@/components/GroupAvatar/GroupAvatar';

export const revalidate = 3600;

Expand Down Expand Up @@ -81,6 +82,10 @@
))}
</ul>
)}
{<GroupAvatar
groupAvatarUrl={gammaGroup?.superGroup.id ? GammaService.getSuperGroupAvatarURL(gammaGroup.superGroup.id) : ''}
groupName={group.prettyName}
/>}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
{<GroupAvatar
groupAvatarUrl={gammaGroup?.superGroup.id ? GammaService.getSuperGroupAvatarURL(gammaGroup.superGroup.id) : ''}
groupName={group.prettyName}
/>}
<GroupAvatar
groupAvatarUrl={gammaGroup?.superGroup.id ? GammaService.getSuperGroupAvatarURL(gammaGroup.superGroup.id) : ''}
groupName={group.prettyName}
/>

Copy link
Member Author

@Alex04412 Alex04412 Dec 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ehm jag tryckte på commit suggestion och nu runnar inte koden.. ;( vet inte varför

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Vad får du för felmeddelande?

Copy link

Copilot AI Dec 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fragment wrapper {...} is unnecessary here. You can directly render the GroupAvatar component without wrapping it in curly braces and a fragment.

Suggested change
{<GroupAvatar
groupAvatarUrl={gammaGroup?.superGroup.id ? GammaService.getSuperGroupAvatarURL(gammaGroup.superGroup.id) : ''}
groupName={group.prettyName}
/>}
<GroupAvatar
groupAvatarUrl={gammaGroup?.superGroup.id ? GammaService.getSuperGroupAvatarURL(gammaGroup.superGroup.id) : ''}
groupName={group.prettyName}
/>

Copilot uses AI. Check for mistakes.
Copy link

Copilot AI Dec 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Passing an empty string as groupAvatarUrl when gammaGroup?.superGroup.id is falsy could cause the FallbackImage component to attempt fetching an invalid URL. Consider conditionally rendering the GroupAvatar component only when a valid superGroup.id exists, similar to how member rendering is handled above (lines 65-84).

Suggested change
{<GroupAvatar
groupAvatarUrl={gammaGroup?.superGroup.id ? GammaService.getSuperGroupAvatarURL(gammaGroup.superGroup.id) : ''}
groupName={group.prettyName}
/>}
{gammaGroup?.superGroup.id && (
<GroupAvatar
groupAvatarUrl={GammaService.getSuperGroupAvatarURL(gammaGroup.superGroup.id)}
groupName={group.prettyName}
/>
)}

Copilot uses AI. Check for mistakes.
</ContentArticle>
);
};
21 changes: 21 additions & 0 deletions src/components/GroupAvatar/GroupAvatar.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
.picture {
width: 8rem;
height: 8rem;
border-radius: 50%;
object-fit: cover;
}

.container {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
text-align: center;
}

.url {
margin-top: 0.5rem;
font-size: 0.75rem;
color: var(--muted-color, #666);
word-break: break-all;
}
Copy link

Copilot AI Dec 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These styles are for debugging purposes and should be removed before merging to production.

Copilot uses AI. Check for mistakes.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot open a new pull request to apply changes based on this feedback

24 changes: 24 additions & 0 deletions src/components/GroupAvatar/GroupAvatar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import FallbackImage from '../FallbackImage/FallbackImage';
import styles from './GroupAvatar.module.scss';

const GroupAvatar = ({
groupAvatarUrl,
Copy link

Copilot AI Dec 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is trailing whitespace after the comma. Please remove it to maintain code consistency.

Suggested change
groupAvatarUrl,
groupAvatarUrl,

Copilot uses AI. Check for mistakes.
groupName
}: {
groupAvatarUrl: string;
groupName: string;
}) => {
return (
<div className={styles.container}>
<FallbackImage
src={groupAvatarUrl}
className={styles.picture}
alt={'Group avatar for ' + groupName}
/>
{/* Render the URL on the page for quick debugging */}
<div className={styles.url}>{groupAvatarUrl}</div>
</div>
);
};

export default GroupAvatar;
4 changes: 4 additions & 0 deletions src/services/gammaService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ export default class GammaService {
return `${this.gammaUrl}/images/group/banner/${gid}`;
}

static getSuperGroupAvatarURL(gid: string) {
return `${this.gammaUrl}/images/super-group/avatar/${gid}`;
}

static isSuperGroupActive(sg: { type: string }) {
return activeGroupTypes.includes(sg.type);
}
Expand Down