Skip to content

Commit b4f6b40

Browse files
committed
feat(movie): allow mods to edit dvd ID
1 parent 9d87dd2 commit b4f6b40

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/components/form-movie-edit.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import {
1818
SelectTrigger,
1919
SelectValue,
2020
} from '@/components/ui/select';
21+
import { useUserRole } from '@/core/utils/hooks';
2122
import {
2223
MovieEditFormSchema,
2324
movieEditFormSchema,
@@ -43,6 +44,8 @@ export function FormMovieEdit({
4344
}: Readonly<{
4445
movie: MovieDto;
4546
}>) {
47+
const userRole = useUserRole();
48+
4649
const [studioSearchValue, setStudioSearchValue] = useState(
4750
movie?.studio?.display_name,
4851
);
@@ -141,7 +144,12 @@ export function FormMovieEdit({
141144
<FormItem>
142145
<FormLabel>DVD ID</FormLabel>
143146
<FormControl>
144-
<Input disabled placeholder="DVD ID" readOnly {...field} />
147+
<Input
148+
disabled={!['admin', 'moderator'].includes(userRole ?? '')}
149+
placeholder="DVD ID"
150+
readOnly={!['admin', 'moderator'].includes(userRole ?? '')}
151+
{...field}
152+
/>
145153
</FormControl>
146154
<FormMessage />
147155
</FormItem>

0 commit comments

Comments
 (0)