mirror of
https://github.com/i701/sarlink-portal.git
synced 2025-10-05 09:55:25 +00:00
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
All checks were successful
Build and Push Docker Images / Build and Push Docker Images (push) Successful in 9m39s
This commit is contained in:
@@ -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}
|
||||
|
@@ -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}
|
||||
/>
|
||||
|
@@ -109,6 +109,7 @@ export async function DevicesTable({
|
||||
parentalControl={parentalControl}
|
||||
key={device.id}
|
||||
device={device}
|
||||
isAdmin={isAdmin}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user