diff --git a/resources/scripts/components/elements/Code.tsx b/resources/scripts/components/elements/Code.tsx index 047ddecf0..30eac0d86 100644 --- a/resources/scripts/components/elements/Code.tsx +++ b/resources/scripts/components/elements/Code.tsx @@ -3,12 +3,13 @@ import classNames from 'classnames'; interface CodeProps { dark?: boolean | undefined; + className?: string; children: React.ReactChild | React.ReactFragment | React.ReactPortal; } -export default ({ dark, children }: CodeProps) => ( +export default ({ dark, className, children }: CodeProps) => ( { const [ loading, setLoading ] = useState(false); - const { clearFlashes, clearAndAddHttpError } = useFlash(); + const { clearFlashes, clearAndAddHttpError } = useFlashKey('server:network'); const uuid = ServerContext.useStoreState(state => state.server.data!.uuid); const { mutate } = getServerAllocations(); @@ -39,69 +39,64 @@ const AllocationRow = ({ allocation }: Props) => { const setAllocationNotes = debounce((notes: string) => { setLoading(true); - clearFlashes('server:network'); + clearFlashes(); setServerAllocationNotes(uuid, allocation.id, notes) .then(() => onNotesChanged(allocation.id, notes)) - .catch(error => clearAndAddHttpError({ key: 'server:network', error })) + .catch(error => clearAndAddHttpError(error)) .then(() => setLoading(false)); }, 750); const setPrimaryAllocation = () => { - clearFlashes('server:network'); + clearFlashes(); mutate(data => data?.map(a => ({ ...a, isDefault: a.id === allocation.id })), false); setPrimaryServerAllocation(uuid, allocation.id) .catch(error => { - clearAndAddHttpError({ key: 'server:network', error }); + clearAndAddHttpError(error); mutate(); }); }; return ( - -
-
+ +
+
-
+
{allocation.alias ? - {allocation.alias} : - {formatIp(allocation.ip)}} + {allocation.alias} : + {formatIp(allocation.ip)}}
-
- {allocation.port} +
+ {allocation.port}
-
+