Skip to content

Commit

Permalink
Removed li elements
Browse files Browse the repository at this point in the history
Modified the namings of checkboxes
  • Loading branch information
Vas9ka committed Aug 6, 2024
1 parent ce36b41 commit 4f88904
Showing 1 changed file with 15 additions and 16 deletions.
31 changes: 15 additions & 16 deletions src/fragmentarium/ui/fragment/ScopeEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,31 +51,30 @@ const ScopeEditor: React.FC<ScopeEditorProps> = ({
const handleSubmit = async () => {
await updateScopes(selectedScopes)
}

const getDisplayScope = (scope: string) => {
return scope.replace('read:', '').replace('-fragments', '')
}
return (
<div>
<h3>Permissions</h3>
<p>
Records with added permissions are visible only to users who have those
permissions.
</p>
<ul>
{fragmentScopes.map((scope) => (
<li key={scope}>
<label>
<input
type="checkbox"
checked={selectedScopes.includes(scope)}
onChange={() => handleScopeChange(scope)}
/>
{scope}
</label>
</li>
))}
</ul>
{fragmentScopes.map((scope) => (
<div key={scope}>
<label>
<input
type="checkbox"
checked={selectedScopes.includes(scope)}
onChange={() => handleScopeChange(scope)}
/>
Restrict it to users with {getDisplayScope(scope)} permissions
</label>
</div>
))}
<Button onClick={handleSubmit}>Update Permissions</Button>
</div>
)
}

export default ScopeEditor

0 comments on commit 4f88904

Please sign in to comment.