Skip to content

Commit

Permalink
feat: Hide server config if is importing from template, for simplicit…
Browse files Browse the repository at this point in the history
…y for new users.

fixes #56
  • Loading branch information
linonetwo committed Mar 31, 2024
1 parent 7d55bdf commit 810e25b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/pages/CreateWorkspace/tabs/CreateFromTemplateTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export const CreateFromTemplateTab = () => {
navigation.navigate('PreviewWebView', { uri });
}}
onUsePress={(uri: string) => {
navigation.navigate('Importer', { uri, autoImportBinary: true, addAsServer: false });
navigation.navigate('Importer', { uri, autoStartImport: true, addAsServer: false });
}}
/>
);
Expand Down
18 changes: 13 additions & 5 deletions src/pages/Importer/Index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,9 @@ export interface ImporterProps {
*/
addAsServer?: boolean;
/**
* Auto trigger the import of binary tiddlers after the import of the HTML
* Auto trigger the import of wiki after select from template list, and import binary tiddlers after the import of the HTML
*/
autoImportBinary?: boolean;
autoStartImport?: boolean;
/**
* The URI to auto fill the server URI input
*/
Expand Down Expand Up @@ -143,8 +143,8 @@ export const Importer: FC<StackScreenProps<RootStackParameterList, 'Importer'>>
skinnyTiddlerTextCacheDownloadPercentage,
} = downloadPercentage;

return (
<Container>
const serverConfigs = (
<>
{qrScannerOpen && (
<LargeBarCodeScanner
// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access
Expand Down Expand Up @@ -190,6 +190,14 @@ export const Importer: FC<StackScreenProps<RootStackParameterList, 'Importer'>>
setServerUriToUseString(newText);
}}
/>
</>
);

const autoStartImport = route.params.autoStartImport;
return (
<Container>
{/* Hide server config if is importing from template, for simplicity for new users. */}
{autoStartImport !== true && serverConfigs}
{importStatus === 'idle' && !qrScannerOpen && wikiUrl !== undefined && (
<>
<TextInput
Expand Down Expand Up @@ -276,7 +284,7 @@ export const Importer: FC<StackScreenProps<RootStackParameterList, 'Importer'>>
<Text>{`${t('Open')} ${createdWikiWorkspace.name}`}</Text>
</OpenWikiButton>
<DoneImportActionsTitleText variant='titleLarge'>{t('OptionalActions')}</DoneImportActionsTitleText>
<ImportBinary wikiWorkspace={createdWikiWorkspace} autoImportBinary={route.params.autoImportBinary} />
<ImportBinary wikiWorkspace={createdWikiWorkspace} autoImportBinary={autoStartImport} />
</>
)}
</Container>
Expand Down

0 comments on commit 810e25b

Please sign in to comment.