1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-12-24 10:27:10 +02:00

WIP: Adjust presentation of the file picker control

This commit is contained in:
Henry Heino 2024-12-23 14:36:06 -08:00
parent a3b555e1a1
commit 00cbe5aaf8
3 changed files with 30 additions and 15 deletions

View File

@ -17,6 +17,7 @@ interface Props {
styles: ConfigScreenStyles;
settingMetadata: SettingItem;
mode: 'read'|'readwrite';
description: React.ReactNode|null;
updateSettingValue: UpdateSettingValueCallback;
}
@ -26,9 +27,11 @@ type ExtendedSelf = (typeof window.self) & {
declare const self: ExtendedSelf;
const pathSelectorStyles = StyleSheet.create({
container: {
flexDirection: 'row',
alignItems: 'center',
innerContainer: {
paddingTop: 0,
paddingBottom: 0,
paddingLeft: 0,
paddingRight: 0,
},
mainButton: {
flexGrow: 1,
@ -95,7 +98,9 @@ const FileSystemPathSelector: FunctionComponent<Props> = props => {
/>
);
return <View style={pathSelectorStyles.container}>
const containerStyles = props.styles.getContainerStyle(!!props.description);
const control = <View style={[containerStyles.innerContainer, pathSelectorStyles.innerContainer]}>
<TouchableRipple
onPress={selectDirectoryButtonPress}
style={pathSelectorStyles.mainButton}
@ -112,6 +117,12 @@ const FileSystemPathSelector: FunctionComponent<Props> = props => {
</TouchableRipple>
{fileSystemPath ? clearButton : null}
</View>;
if (!supported) return null;
return <View style={containerStyles.outerContainer}>
{control}
{props.description}
</View>;
};
export default FileSystemPathSelector;

View File

@ -124,16 +124,14 @@ const SettingComponent: React.FunctionComponent<Props> = props => {
} else if (md.type === Setting.TYPE_STRING) {
if (['sync.2.path', 'plugins.devPluginPaths'].includes(md.key) && (shim.fsDriver().isUsingAndroidSAF() || shim.mobilePlatform() === 'web')) {
return (
<View style={containerStyles.outerContainer}>
<FileSystemPathSelector
themeId={props.themeId}
mode={md.key === 'sync.2.path' ? 'readwrite' : 'read'}
styles={props.styles}
settingMetadata={md}
updateSettingValue={props.updateSettingValue}
/>
{descriptionComp}
</View>
<FileSystemPathSelector
themeId={props.themeId}
mode={md.key === 'sync.2.path' ? 'readwrite' : 'read'}
styles={props.styles}
settingMetadata={md}
updateSettingValue={props.updateSettingValue}
description={descriptionComp}
/>
);
}

View File

@ -931,7 +931,13 @@ const builtInMetadata = (Setting: typeof SettingType) => {
advanced: true,
appTypes: [AppType.Desktop, AppType.Mobile],
// For now, development plugins are only enabled on desktop & web.
show: () => shim.isElectron() || shim.mobilePlatform() === 'web',
show: (settings) => {
if (shim.isElectron()) return true;
if (shim.mobilePlatform() !== 'web') return false;
const pluginSupportEnabled = settings['plugins.pluginSupportEnabled'];
return !!pluginSupportEnabled;
},
label: () => 'Development plugins',
description: () => {
if (shim.mobilePlatform()) {