Skip to content

optimize the style and interaction of MainView/MultiSelectionsPickerV…#2

Closed
thomfang wants to merge 1 commit intoschl3ck:mainfrom
ScriptingApp:main
Closed

optimize the style and interaction of MainView/MultiSelectionsPickerV…#2
thomfang wants to merge 1 commit intoschl3ck:mainfrom
ScriptingApp:main

Conversation

@thomfang
Copy link
Copy Markdown

@thomfang thomfang commented May 9, 2025

I optimized the style of the MainView page and fixed a bug where the entire page would close when selecting either the Lib file or Target folder.
Additionally, I made some style adjustments to the MultiSelectionsPickerView.

}, [content])

return (
<NavigationStack>
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I thought that I have to include a NavigationStack at the root of a component when the component is used in Navigation.present or as target of a NavigationLink. Is this not the case?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Navigation.present needs it but NavigationLink doesn’t need it anymore

@schl3ck
Copy link
Copy Markdown
Owner

schl3ck commented May 9, 2025

I have to test the changes when I have access to a computer and then I'll report back.

Copy link
Copy Markdown
Owner

@schl3ck schl3ck left a comment

Choose a reason for hiding this comment

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

Everything else looks good!

setContent([folder, ...content])
}
action={() => {
dismiss()
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

When selecting a file more than one folder deep it also dismisses the main view. Although this might never be needed, it would be nice to fix it now. You never know.

Selecting a file just one folder deep works.

Comment on lines +105 to +148
<NavigationLink
destination={
<Folder
key={"libDestination"}
path={Script.directory}
select="file"
onSelection={(p) => {
setFrom(p)
}}
tip={"Select a file to link"}
/>
}
>
<Text>Lib</Text>
<Spacer />
<Text>{from.replace(Script.directory + "/", "")}</Text>
<Image
systemName="chevron.right"
foregroundStyle="tertiaryLabel"
/>
</HStack>
<HStack
contentShape={"rect"}
onTapGesture={async () => {
Navigation.present(
<Folder
path={parentFolder}
select="folder"
onSelection={(p, dismiss) => {
setTo(p)
dismiss()
}}
cancel={dismiss}
/>,
)
}}
<HStack>
<Text>Select a Lib File</Text>
<Spacer />
<Text
foregroundStyle={"secondaryLabel"}
font={"callout"}
>{from.replace(Script.directory + "/", "")}</Text>
</HStack>
</NavigationLink>
<NavigationLink
destination={
<Folder
key={"targetDestination"}
path={parentFolder}
select="folder"
topLevel
onSelection={(p) => {
setTo(p)
}}
/>
}
>
<Text>Target</Text>
<Spacer />
<Text>{to.replace(parentFolder + "/", "")}</Text>
<Image
systemName="chevron.right"
foregroundStyle="tertiaryLabel"
/>
</HStack>
<HStack>
<Text>Select a Target Folder</Text>
<Spacer />
<Text
foregroundStyle={"secondaryLabel"}
font={"callout"}
>{to.replace(parentFolder + "/", "")}</Text>
</HStack>
</NavigationLink>
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Why a NavigationLink? Because the way I styled it? If yes, then what would be an appropriate style for a separate sheet?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Create/edit something should use a sheet/fullScreenCover page, and the details/subcategory page should use NavigationLink.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I assume this is an Apple style guideline, but when selecting a file or folder in some third-party apps via the iOS built-in selection dialog it is also a sheet.

Also when selecting a file or folder and then to return to the main view we need to dismiss each folder. With a sheet we only need to dismiss the sheet which is a much smoother animation in my opinion.

Because of these arguments I think a sheet is better.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Yes, it is an Apple style guideline. You can implement it depending the ideal UX.

According to the usage scenario you mentioned, you can separate the selection file and the selection directory into two pages, which will be clearer, and you don't need to make too many conditional judgments on the interaction.

My code is just a reference, maybe I don't have a good understanding of your functional intent, you can take a look at the reference meaningful code.

schl3ck added a commit that referenced this pull request May 16, 2025
schl3ck added a commit that referenced this pull request May 16, 2025
Cherry pick UI improvements from #2 without using `<NavigationStack>`
@schl3ck
Copy link
Copy Markdown
Owner

schl3ck commented May 16, 2025

I've cherry picked your improvements without using <NavigationLink> for the selection of library file and destination folder in #3. Therefore I'm closing this. Thank you for your contribution!

@schl3ck schl3ck closed this May 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants