fix: allow admins only to block with details in parental control page (mobile view) 🐛
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 9m39s

This commit is contained in:
2025-09-20 19:07:08 +05:00
parent 035cd02012
commit 5277c13fb7
3 changed files with 234 additions and 232 deletions

View File

@@ -37,7 +37,7 @@ const initialState: BlockDeviceFormState = {
export default function BlockDeviceDialog({
device,
// admin,
admin,
parentalControl = false,
}: {
device: Device;
@@ -100,7 +100,7 @@ export default function BlockDeviceDialog({
}
// If device is not blocked and user is not admin, show simple block button
if (!device.blocked && parentalControl) {
if ((!device.blocked && parentalControl) || !admin) {
return (
<Button
onClick={handleSimpleBlock}

View File

@@ -12,6 +12,7 @@ import { Badge } from "./ui/badge";
export default function DeviceCard({
device,
parentalControl,
isAdmin,
}: {
device: Device;
parentalControl?: boolean;
@@ -104,7 +105,7 @@ export default function DeviceCard({
<AddDevicesToCartButton device={device} />
) : (
<BlockDeviceDialog
admin={false}
admin={isAdmin}
type={device.blocked ? "unblock" : "block"}
device={device}
/>

View File

@@ -109,6 +109,7 @@ export async function DevicesTable({
parentalControl={parentalControl}
key={device.id}
device={device}
isAdmin={isAdmin}
/>
))}
</div>