Skip to content
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

723 multiple fixes #724

Merged
merged 6 commits into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion packages/berlin/src/components/cycles/Cycles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function Cycles({ cycles, errorMessage, eventId }: CyclesProps) {
{cycles?.length ? (
cycles.map((cycle) => (
<article
className="border-secondary flex w-full flex-col gap-4 border p-4"
className="border-secondary flex w-full cursor-pointer flex-col gap-4 border p-4"
key={cycle.id}
onClick={() => handleCycleClick(cycle.id)}
>
Expand Down
21 changes: 4 additions & 17 deletions packages/berlin/src/components/events/Events.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import Markdown from 'react-markdown';
// React and third-party libraries
import { useNavigate } from 'react-router-dom';

// API
import { GetEventResponse } from 'api';

// Components
import { Body } from '../typography/Body.styled';
import { Subtitle } from '../typography/Subtitle.styled';
import Link from '../link';
import { useNavigate } from 'react-router-dom';

type EventsProps = {
events: GetEventResponse[] | undefined;
Expand All @@ -29,20 +30,6 @@ export default function Events({ events, errorMessage }: EventsProps) {
>
<section className="flex flex-col gap-4 p-4">
<Subtitle>{event.name}</Subtitle>
{event.description && (
<Markdown
components={{
a: ({ node, ...props }) => <Link to={props.href ?? ''}>{props.children}</Link>,
p: ({ node, ...props }) => (
<Body className="truncate" style={{ whiteSpace: 'nowrap' }}>
{props.children}
</Body>
),
}}
>
{event.description}
</Markdown>
)}
</section>
{event.imageUrl && (
<section className="h-40 w-full">
Expand Down
2 changes: 1 addition & 1 deletion packages/berlin/src/components/header/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ const HeaderLinks = ({ user }: { user: GetUserResponse }) => {

const eventBaseLinks = [
{
title: 'My Proposals',
title: 'Registration',
link: `/events/${eventId}/register`,
},
{
Expand Down
37 changes: 25 additions & 12 deletions packages/berlin/src/pages/Event.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,31 @@ function Event() {
<>
<Onboarding steps={eventSteps} type="event" />
<FlexColumn $gap="2rem" className="event">
<BackButton />
<section className="flex flex-col gap-4">
<Subtitle>{event?.name}</Subtitle>
{event?.description && (
<Markdown
components={{
a: ({ node, ...props }) => <Link to={props.href ?? ''}>{props.children}</Link>,
p: ({ node, ...props }) => <Body>{props.children}</Body>,
}}
>
{event.description}
</Markdown>
<section className="grid grid-cols-3 gap-x-4">
<div className={`${event?.imageUrl ? 'col-span-2' : 'col-span-3'} flex flex-col gap-4`}>
<BackButton />
<Subtitle>{event?.name}</Subtitle>
{event?.description && (
<div>
<Markdown
components={{
a: ({ node, ...props }) => <Link to={props.href ?? ''}>{props.children}</Link>,
p: ({ node, ...props }) => <Body>{props.children}</Body>,
}}
>
{event.description}
</Markdown>
</div>
)}
</div>
{event?.imageUrl && (
<div className="col-span-1">
<img
src={event?.imageUrl}
alt={`${event.name} image`}
className="h-full w-full object-cover object-center"
/>
</div>
Comment on lines +76 to +83
Copy link
Contributor

Choose a reason for hiding this comment

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

Ensure proper handling of missing image data.

The code assumes that event.imageUrl is always defined. Add a fallback or placeholder image to handle cases where event.imageUrl is undefined.

-          {event?.imageUrl && (
-            <div className="col-span-1">
-              <img
-                src={event?.imageUrl}
-                alt={`${event.name} image`}
-                className="h-full w-full object-cover object-center"
-              />
-            </div>
-          )}
+          <div className="col-span-1">
+            <img
+              src={event?.imageUrl || '/path/to/placeholder/image.jpg'}
+              alt={event ? `${event.name} image` : 'Placeholder image'}
+              className="h-full w-full object-cover object-center"
+            />
+          </div>
Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
{event?.imageUrl && (
<div className="col-span-1">
<img
src={event?.imageUrl}
alt={`${event.name} image`}
className="h-full w-full object-cover object-center"
/>
</div>
<div className="col-span-1">
<img
src={event?.imageUrl || '/path/to/placeholder/image.jpg'}
alt={event ? `${event.name} image` : 'Placeholder image'}
className="h-full w-full object-cover object-center"
/>
</div>

)}
</section>
<section className="flex w-full flex-col justify-between gap-2 md:flex-row md:items-center">
Expand Down
2 changes: 1 addition & 1 deletion packages/berlin/src/pages/Events.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function Events() {
<Title>Events</Title>
<Tabs.TabsHeader className="tabs" tabNames={tabNames} onTabChange={setActiveTab} />
</section>
<section className="grid w-full grid-cols-2 gap-4">
<section className="grid w-full gap-4 md:grid-cols-2">
<Tabs.TabsManager tabs={tabs} tab={activeTab} fallback={'Tab not found'} />
</section>
</FlexColumn>
Expand Down
Loading