@@ -3,11 +3,11 @@ import {
33 Grid ,
44 Heading ,
55 HStack ,
6- HTMLChakraProps ,
76 Input ,
87 Stack ,
98 StackProps ,
109 Text ,
10+ TextProps ,
1111 VStack ,
1212} from "@chakra-ui/react" ;
1313import DefaultPageLayout , {
@@ -28,7 +28,7 @@ import {
2828} from "@microbit/makecode-embed/vanilla" ;
2929import { createDataSamplesPageUrl } from "../urls" ;
3030import { useProject } from "../hooks/project-hooks" ;
31- import { ActionData } from "../model" ;
31+ import { ActionData , DatasetEditorJsonFormat } from "../model" ;
3232import DataSamplesTableRow from "../components/DataSamplesTableRow" ;
3333import { MakeCodeRenderBlocksProvider } from "@microbit/makecode-embed" ;
3434import { getMakeCodeLang } from "../settings" ;
@@ -57,7 +57,7 @@ const contentStackProps: Partial<StackProps> = {
5757 width : [ "unset" , "unset" , "2xl" , "80%" ] ,
5858} ;
5959
60- const readableProps : Partial < HTMLChakraProps < any > > = {
60+ const readableProps : Partial < TextProps > = {
6161 width : "65ch" ,
6262} ;
6363
@@ -103,7 +103,9 @@ export const ImportSharedURLPage = () => {
103103 setSharedState ( SharedState . Complete ) ;
104104 setProjectText ( text ) ;
105105 if ( text [ "dataset.json" ] ) {
106- setDataset ( JSON . parse ( text [ "dataset.json" ] ) . data ) ;
106+ setDataset (
107+ ( JSON . parse ( text [ "dataset.json" ] ) as DatasetEditorJsonFormat ) . data
108+ ) ;
107109 }
108110 } )
109111 . catch ( ( e ) => {
@@ -270,32 +272,43 @@ const PreviewData = ({ dataset }: PreviewDataProps) => {
270272 < Heading as = "h1" mb = { 5 } >
271273 < FormattedMessage id = "import-shared-url-data-preview" />
272274 </ Heading >
273- < Grid
274- gridTemplateColumns = "290px 1fr"
275- gap = { 3 }
275+ < VStack
276276 px = { 5 }
277- w = "100%"
278- py = { 2 }
279- alignItems = "start"
280- autoRows = "max-content"
281- overflow = "auto"
277+ w = "full"
278+ h = { 0 }
279+ justifyContent = "start"
282280 flexGrow = { 1 }
281+ alignItems = "start"
282+ overflowX = "auto"
283+ flexShrink = { 1 }
283284 >
284- { dataset . map ( ( action ) => (
285- < DataSamplesTableRow
286- key = { action . ID }
287- action = { action }
288- newRecordingId = { 0 }
289- clearNewRecordingId = { ( ) => { } }
290- selected = { false }
291- onSelectRow = { ( ) => { } }
292- onRecord = { ( ) => { } }
293- showHints = { false }
294- onDeleteAction = { ( ) => { } }
295- renameShortcutScopeRef = { ( ) => { } }
296- />
297- ) ) }
298- </ Grid >
285+ < Grid
286+ gridTemplateColumns = "290px 1fr"
287+ gap = { 3 }
288+ px = { 5 }
289+ w = "100%"
290+ py = { 2 }
291+ alignItems = "start"
292+ autoRows = "max-content"
293+ overflow = "auto"
294+ flexGrow = { 1 }
295+ >
296+ { dataset . map ( ( action ) => (
297+ < DataSamplesTableRow
298+ key = { action . ID }
299+ action = { action }
300+ newRecordingId = { 0 }
301+ clearNewRecordingId = { ( ) => { } }
302+ selected = { false }
303+ onSelectRow = { ( ) => { } }
304+ onRecord = { ( ) => { } }
305+ showHints = { false }
306+ onDeleteAction = { ( ) => { } }
307+ renameShortcutScopeRef = { ( ) => { } }
308+ />
309+ ) ) }
310+ </ Grid >
311+ </ VStack >
299312 </ >
300313 ) ;
301314} ;
@@ -323,7 +336,7 @@ const MakeCodePreview = ({ project }: MakeCodePreviewProps) => {
323336 alignItems = "start"
324337 overflow = "auto"
325338 flexShrink = { 1 }
326- ref = { scrollableAreaRef as React . RefObject < HTMLDivElement > }
339+ ref = { scrollableAreaRef }
327340 > </ VStack >
328341 < CodeViewCard parentRef = { scrollableAreaRef } project = { project } />
329342 </ MakeCodeRenderBlocksProvider >
@@ -356,4 +369,3 @@ const fetchSharedProjectText = async (longId: string): Promise<ScriptText> => {
356369 }
357370 return text ;
358371} ;
359-
0 commit comments