From d755425354e33db93dd899a79fb340351334435c Mon Sep 17 00:00:00 2001 From: gkLeo Date: Sun, 7 Apr 2024 17:19:39 +0800 Subject: [PATCH 1/4] resolve Agenda and Sessions addition error --- .../Sugcon2024/Sugcon/src/components/Events/Agenda.tsx | 10 ++++++---- .../Sugcon/src/components/Events/Sessions.tsx | 10 ++++++---- .../items/Renderings/Sugcon2024/Events/Agenda.yml | 10 +++++----- .../items/Renderings/Sugcon2024/Events/Sessions.yml | 10 +++++----- 4 files changed, 22 insertions(+), 18 deletions(-) diff --git a/src/Project/Sugcon2024/Sugcon/src/components/Events/Agenda.tsx b/src/Project/Sugcon2024/Sugcon/src/components/Events/Agenda.tsx index ce80803bf..d82818425 100644 --- a/src/Project/Sugcon2024/Sugcon/src/components/Events/Agenda.tsx +++ b/src/Project/Sugcon2024/Sugcon/src/components/Events/Agenda.tsx @@ -1,13 +1,13 @@ 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 { ComponentProps } from 'lib/component-props'; interface Fields { SessionizeUrl: Field; } -type AgendaProps = { - params: { [key: string]: string }; +type AgendaProps = ComponentProps & { fields: Fields; }; @@ -19,7 +19,7 @@ const AgendaDefaultComponent = (props: AgendaProps): JSX.Element => ( ); -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()); @@ -50,3 +50,5 @@ export const Default = (props: AgendaProps): JSX.Element => { ); }; + +export const Default = withDatasourceCheck()(AgendaComponent); diff --git a/src/Project/Sugcon2024/Sugcon/src/components/Events/Sessions.tsx b/src/Project/Sugcon2024/Sugcon/src/components/Events/Sessions.tsx index 3ab22c776..00d72c242 100644 --- a/src/Project/Sugcon2024/Sugcon/src/components/Events/Sessions.tsx +++ b/src/Project/Sugcon2024/Sugcon/src/components/Events/Sessions.tsx @@ -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; } -type SessionsProps = { - params: { [key: string]: string }; +type SessionsProps = ComponentProps & { fields: Fields; }; @@ -21,7 +21,7 @@ const SessionsDefaultComponent = (props: SessionsProps): JSX.Element => ( ); -export const Default = (props: SessionsProps): JSX.Element => { +export const SessionsComponent = (props: SessionsProps): JSX.Element => { const id = props.params.RenderingIdentifier || undefined; const fetcher = (url: string) => fetch(url).then((res) => res.text()); @@ -54,3 +54,5 @@ export const Default = (props: SessionsProps): JSX.Element => { ); }; + +export const Default = withDatasourceCheck()(SessionsComponent); diff --git a/src/Project/Sugcon2024/items/Renderings/Sugcon2024/Events/Agenda.yml b/src/Project/Sugcon2024/items/Renderings/Sugcon2024/Events/Agenda.yml index c2638de09..5b424d0ea 100644 --- a/src/Project/Sugcon2024/items/Renderings/Sugcon2024/Events/Agenda.yml +++ b/src/Project/Sugcon2024/items/Renderings/Sugcon2024/Events/Agenda.yml @@ -18,13 +18,13 @@ SharedFields: Value: 0 - ID: "9c6106ea-7a5a-48e2-8cad-f0f693b1e2d4" Hint: __Read Only - Value: 0 + Value: - ID: "a77e8568-1ab3-44f1-a664-b7c37ec7810d" Hint: Parameters Template Value: "{1DFA17C5-0B40-4D43-A718-720BD65F65E6}" - ID: "b5b27af1-25ef-405c-87ce-369b3a004016" Hint: Datasource Location - Value: "query:./Data" + Value: "query:$site/*[@@name='Data']" - ID: "c39a90ce-0035-41bb-90f6-3c8a6ea87797" Hint: AddFieldEditorButton Value: @@ -74,14 +74,14 @@ Languages: sitecore\JssImport - ID: "8cdc337e-a112-42fb-bbb4-4143751e123f" Hint: __Revision - Value: "4f62bc23-faff-46aa-9dd6-eedaae0a9a61" + Value: "363a183b-5e4b-4a68-bb21-e16953be090e" - ID: "badd9cf9-53e0-4d0c-bcc0-2d784c282f6a" Hint: __Updated by Value: | - sitecore\x3rLvWVVyq + sitecore\LsPuHOnvmf - ID: "d9cf14b1-fa16-4ba6-9288-e8a174d4d522" Hint: __Updated - Value: 20240228T190322Z + Value: 20240407T090642Z - Language: "ja-JP" Fields: - ID: "b5e02ad9-d56f-4c41-a065-a133db87bdeb" diff --git a/src/Project/Sugcon2024/items/Renderings/Sugcon2024/Events/Sessions.yml b/src/Project/Sugcon2024/items/Renderings/Sugcon2024/Events/Sessions.yml index aa3e244b3..ce09ea948 100644 --- a/src/Project/Sugcon2024/items/Renderings/Sugcon2024/Events/Sessions.yml +++ b/src/Project/Sugcon2024/items/Renderings/Sugcon2024/Events/Sessions.yml @@ -18,13 +18,13 @@ SharedFields: Value: 0 - ID: "9c6106ea-7a5a-48e2-8cad-f0f693b1e2d4" Hint: __Read Only - Value: 0 + Value: - ID: "a77e8568-1ab3-44f1-a664-b7c37ec7810d" Hint: Parameters Template Value: "{C8DF4EA0-57FE-4D1C-B3A0-3E908FC6B34F}" - ID: "b5b27af1-25ef-405c-87ce-369b3a004016" Hint: Datasource Location - Value: "query:./Data" + Value: "query:$site/*[@@name='Data']" - ID: "c39a90ce-0035-41bb-90f6-3c8a6ea87797" Hint: AddFieldEditorButton Value: @@ -74,14 +74,14 @@ Languages: sitecore\JssImport - ID: "8cdc337e-a112-42fb-bbb4-4143751e123f" Hint: __Revision - Value: "2ff18311-634a-431c-b425-c5cb7fb4ac34" + Value: "3b23cc80-7c20-443e-9c19-10f345c868dd" - ID: "badd9cf9-53e0-4d0c-bcc0-2d784c282f6a" Hint: __Updated by Value: | - sitecore\1ISa5gYrpM + sitecore\LsPuHOnvmf - ID: "d9cf14b1-fa16-4ba6-9288-e8a174d4d522" Hint: __Updated - Value: 20240313T020900Z + Value: 20240407T090841Z - Language: "ja-JP" Fields: - ID: "b5e02ad9-d56f-4c41-a065-a133db87bdeb" From cfcf5471cca40932ee8b03812a9e03fc0e53e263 Mon Sep 17 00:00:00 2001 From: gkLeo Date: Sun, 7 Apr 2024 17:31:13 +0800 Subject: [PATCH 2/4] remove extra 'export' in Sessions --- .../Sugcon2024/Sugcon/src/components/Events/Sessions.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Project/Sugcon2024/Sugcon/src/components/Events/Sessions.tsx b/src/Project/Sugcon2024/Sugcon/src/components/Events/Sessions.tsx index 00d72c242..480a7a263 100644 --- a/src/Project/Sugcon2024/Sugcon/src/components/Events/Sessions.tsx +++ b/src/Project/Sugcon2024/Sugcon/src/components/Events/Sessions.tsx @@ -21,7 +21,7 @@ const SessionsDefaultComponent = (props: SessionsProps): JSX.Element => ( ); -export const SessionsComponent = (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()); From e6bf58405c2e69f7e95269bb3fdfb5bbfed55cd3 Mon Sep 17 00:00:00 2001 From: gkLeo Date: Tue, 30 Apr 2024 16:18:38 +0800 Subject: [PATCH 3/4] resolve conflict --- src/Project/Sugcon2024/Sugcon/src/components/Events/Agenda.tsx | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Project/Sugcon2024/Sugcon/src/components/Events/Agenda.tsx b/src/Project/Sugcon2024/Sugcon/src/components/Events/Agenda.tsx index 617ba47ca..72faffe8a 100644 --- a/src/Project/Sugcon2024/Sugcon/src/components/Events/Agenda.tsx +++ b/src/Project/Sugcon2024/Sugcon/src/components/Events/Agenda.tsx @@ -1,6 +1,5 @@ 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'; From 3b0811bdb415d17e381dea9983ed33a14761f301 Mon Sep 17 00:00:00 2001 From: gkLeo Date: Fri, 19 Jul 2024 16:31:39 +0800 Subject: [PATCH 4/4] Fix Storybook issues for Agenda and Sessions --- .../src/stories/components/Events/Agenda.stories.tsx | 3 +++ .../src/stories/components/Events/Sessions.stories.tsx | 3 +++ .../items/Renderings/Sugcon2024/Events/Agenda.yml | 10 +++++----- .../items/Renderings/Sugcon2024/Events/Sessions.yml | 10 +++++----- 4 files changed, 16 insertions(+), 10 deletions(-) diff --git a/src/Project/Sugcon2024/Sugcon/src/stories/components/Events/Agenda.stories.tsx b/src/Project/Sugcon2024/Sugcon/src/stories/components/Events/Agenda.stories.tsx index b4aed14eb..286dae712 100644 --- a/src/Project/Sugcon2024/Sugcon/src/stories/components/Events/Agenda.stories.tsx +++ b/src/Project/Sugcon2024/Sugcon/src/stories/components/Events/Agenda.stories.tsx @@ -15,6 +15,9 @@ type Story = StoryObj; export const AgendaStory: Story = { name: 'Agenda', args: { + rendering: { + componentName: 'Agenda', + }, params: { styles: '', }, diff --git a/src/Project/Sugcon2024/Sugcon/src/stories/components/Events/Sessions.stories.tsx b/src/Project/Sugcon2024/Sugcon/src/stories/components/Events/Sessions.stories.tsx index 3108cd1a5..6af6f4296 100644 --- a/src/Project/Sugcon2024/Sugcon/src/stories/components/Events/Sessions.stories.tsx +++ b/src/Project/Sugcon2024/Sugcon/src/stories/components/Events/Sessions.stories.tsx @@ -15,6 +15,9 @@ type Story = StoryObj; export const SessionsStory: Story = { name: 'Sessions', args: { + rendering: { + componentName: 'Sessions', + }, params: { styles: '', }, diff --git a/src/Project/Sugcon2024/items/Renderings/Sugcon2024/Events/Agenda.yml b/src/Project/Sugcon2024/items/Renderings/Sugcon2024/Events/Agenda.yml index 5b424d0ea..c2638de09 100644 --- a/src/Project/Sugcon2024/items/Renderings/Sugcon2024/Events/Agenda.yml +++ b/src/Project/Sugcon2024/items/Renderings/Sugcon2024/Events/Agenda.yml @@ -18,13 +18,13 @@ SharedFields: Value: 0 - ID: "9c6106ea-7a5a-48e2-8cad-f0f693b1e2d4" Hint: __Read Only - Value: + Value: 0 - ID: "a77e8568-1ab3-44f1-a664-b7c37ec7810d" Hint: Parameters Template Value: "{1DFA17C5-0B40-4D43-A718-720BD65F65E6}" - ID: "b5b27af1-25ef-405c-87ce-369b3a004016" Hint: Datasource Location - Value: "query:$site/*[@@name='Data']" + Value: "query:./Data" - ID: "c39a90ce-0035-41bb-90f6-3c8a6ea87797" Hint: AddFieldEditorButton Value: @@ -74,14 +74,14 @@ Languages: sitecore\JssImport - ID: "8cdc337e-a112-42fb-bbb4-4143751e123f" Hint: __Revision - Value: "363a183b-5e4b-4a68-bb21-e16953be090e" + Value: "4f62bc23-faff-46aa-9dd6-eedaae0a9a61" - ID: "badd9cf9-53e0-4d0c-bcc0-2d784c282f6a" Hint: __Updated by Value: | - sitecore\LsPuHOnvmf + sitecore\x3rLvWVVyq - ID: "d9cf14b1-fa16-4ba6-9288-e8a174d4d522" Hint: __Updated - Value: 20240407T090642Z + Value: 20240228T190322Z - Language: "ja-JP" Fields: - ID: "b5e02ad9-d56f-4c41-a065-a133db87bdeb" diff --git a/src/Project/Sugcon2024/items/Renderings/Sugcon2024/Events/Sessions.yml b/src/Project/Sugcon2024/items/Renderings/Sugcon2024/Events/Sessions.yml index ce09ea948..aa3e244b3 100644 --- a/src/Project/Sugcon2024/items/Renderings/Sugcon2024/Events/Sessions.yml +++ b/src/Project/Sugcon2024/items/Renderings/Sugcon2024/Events/Sessions.yml @@ -18,13 +18,13 @@ SharedFields: Value: 0 - ID: "9c6106ea-7a5a-48e2-8cad-f0f693b1e2d4" Hint: __Read Only - Value: + Value: 0 - ID: "a77e8568-1ab3-44f1-a664-b7c37ec7810d" Hint: Parameters Template Value: "{C8DF4EA0-57FE-4D1C-B3A0-3E908FC6B34F}" - ID: "b5b27af1-25ef-405c-87ce-369b3a004016" Hint: Datasource Location - Value: "query:$site/*[@@name='Data']" + Value: "query:./Data" - ID: "c39a90ce-0035-41bb-90f6-3c8a6ea87797" Hint: AddFieldEditorButton Value: @@ -74,14 +74,14 @@ Languages: sitecore\JssImport - ID: "8cdc337e-a112-42fb-bbb4-4143751e123f" Hint: __Revision - Value: "3b23cc80-7c20-443e-9c19-10f345c868dd" + Value: "2ff18311-634a-431c-b425-c5cb7fb4ac34" - ID: "badd9cf9-53e0-4d0c-bcc0-2d784c282f6a" Hint: __Updated by Value: | - sitecore\LsPuHOnvmf + sitecore\1ISa5gYrpM - ID: "d9cf14b1-fa16-4ba6-9288-e8a174d4d522" Hint: __Updated - Value: 20240407T090841Z + Value: 20240313T020900Z - Language: "ja-JP" Fields: - ID: "b5e02ad9-d56f-4c41-a065-a133db87bdeb"