X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/59fc59f324194f2762dae92cf94bd4a05e33cb09..1e1abe6a0146d3f31836334a7e5880e349afed24:/src/views-components/sharing-dialog/sharing-public-access-form-component.tsx

diff --git a/src/views-components/sharing-dialog/sharing-public-access-form-component.tsx b/src/views-components/sharing-dialog/sharing-public-access-form-component.tsx
index 5f57a927..03e9413e 100644
--- a/src/views-components/sharing-dialog/sharing-public-access-form-component.tsx
+++ b/src/views-components/sharing-dialog/sharing-public-access-form-component.tsx
@@ -8,6 +8,7 @@ import { Field, WrappedFieldProps } from 'redux-form';
 import { WithStyles } from '@material-ui/core/styles';
 import withStyles from '@material-ui/core/styles/withStyles';
 import { VisibilityLevelSelect } from './visibility-level-select';
+import { VisibilityLevel } from '~/store/sharing-dialog/sharing-dialog-types';
 
 const sharingPublicAccessStyles: StyleRulesCallback<'root'> = theme => ({
     root: {
@@ -16,12 +17,14 @@ const sharingPublicAccessStyles: StyleRulesCallback<'root'> = theme => ({
 });
 
 const SharingPublicAccessForm = withStyles(sharingPublicAccessStyles)(
-    ({ classes }: WithStyles<'root'>) =>
+    ({ classes, visibility }: WithStyles<'root'> & { visibility: VisibilityLevel }) =>
         <>
             <Divider />
             <Grid container alignItems='center' spacing={8} className={classes.root}>
                 <Grid item xs={8}>
-                    <Typography variant='subheading'>Public visibility</Typography>
+                    <Typography variant='subtitle1'>
+                        {renderVisibilityInfo(visibility)}
+                    </Typography>
                 </Grid>
                 <Grid item xs={4} container wrap='nowrap'>
                     <Field name='visibility' component={VisibilityLevelSelectComponent} />
@@ -30,7 +33,21 @@ const SharingPublicAccessForm = withStyles(sharingPublicAccessStyles)(
         </>
 );
 
-export default () => <SharingPublicAccessForm />;
+const renderVisibilityInfo = (visibility: VisibilityLevel) => {
+    switch (visibility) {
+        case VisibilityLevel.PUBLIC:
+            return 'Anyone can access';
+        case VisibilityLevel.SHARED:
+            return 'Specific people can access';
+        case VisibilityLevel.PRIVATE:
+            return 'Only you can access';
+        default:
+            return '';
+    }
+};
+
+export default ({ visibility }: { visibility: VisibilityLevel }) =>
+    <SharingPublicAccessForm {...{ visibility }} />;
 
 const VisibilityLevelSelectComponent = ({ input }: WrappedFieldProps) =>
     <VisibilityLevelSelect fullWidth disableUnderline {...input} />;
