Skip to content

Commit

Permalink
Merge pull request #451 from gkLeo/bug/EventsComponents
Browse files Browse the repository at this point in the history
SUGCON24 EU: Fix Agenda and Sessions addition error bug
  • Loading branch information
robearlam authored Jul 22, 2024
2 parents 2fb9451 + 3b0811b commit a5f3627
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 8 deletions.
10 changes: 6 additions & 4 deletions src/Project/Sugcon2024/Sugcon/src/components/Events/Agenda.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import React from 'react';
import InnerHTML from 'dangerously-set-html-content';
import { Field } from '@sitecore-jss/sitecore-jss-nextjs';
import { Field, withDatasourceCheck } from '@sitecore-jss/sitecore-jss-nextjs';
import useSWR from 'swr';
import { ComponentProps } from 'lib/component-props';

interface Fields {
SessionizeUrl: Field<string>;
}

type AgendaProps = {
params: { [key: string]: string };
type AgendaProps = ComponentProps & {
fields: Fields;
};

Expand All @@ -20,7 +20,7 @@ const AgendaDefaultComponent = (props: AgendaProps): JSX.Element => (
</div>
);

export const Default = (props: AgendaProps): JSX.Element => {
const AgendaComponent = (props: AgendaProps): JSX.Element => {
const id = props.params.RenderingIdentifier;

const fetcher = (url: string) => fetch(url).then((res) => res.text());
Expand Down Expand Up @@ -51,3 +51,5 @@ export const Default = (props: AgendaProps): JSX.Element => {
</div>
);
};

export const Default = withDatasourceCheck()<AgendaProps>(AgendaComponent);
10 changes: 6 additions & 4 deletions src/Project/Sugcon2024/Sugcon/src/components/Events/Sessions.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import React from 'react';
import { Field } from '@sitecore-jss/sitecore-jss-nextjs';
import { Field, withDatasourceCheck } from '@sitecore-jss/sitecore-jss-nextjs';
import useSWR from 'swr';
import clsx from 'clsx';
import { Flex } from '@chakra-ui/react';
import { ComponentProps } from 'lib/component-props';

interface Fields {
SessionizeUrl: Field<string>;
}

type SessionsProps = {
params: { [key: string]: string };
type SessionsProps = ComponentProps & {
fields: Fields;
};

Expand All @@ -21,7 +21,7 @@ const SessionsDefaultComponent = (props: SessionsProps): JSX.Element => (
</div>
);

export const Default = (props: SessionsProps): JSX.Element => {
const SessionsComponent = (props: SessionsProps): JSX.Element => {
const id = props.params.RenderingIdentifier || undefined;

const fetcher = (url: string) => fetch(url).then((res) => res.text());
Expand Down Expand Up @@ -54,3 +54,5 @@ export const Default = (props: SessionsProps): JSX.Element => {
</Flex>
);
};

export const Default = withDatasourceCheck()<SessionsProps>(SessionsComponent);
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ type Story = StoryObj<typeof meta>;
export const AgendaStory: Story = {
name: 'Agenda',
args: {
rendering: {
componentName: 'Agenda',
},
params: {
styles: '',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ type Story = StoryObj<typeof meta>;
export const SessionsStory: Story = {
name: 'Sessions',
args: {
rendering: {
componentName: 'Sessions',
},
params: {
styles: '',
},
Expand Down

0 comments on commit a5f3627

Please sign in to comment.