mirror of
https://github.com/pybricks/pybricks-code.git
synced 2026-09-14 10:35:11 +00:00
notifications: allow viewing stack trace of unexpected error
Previously, it was only possible to view the stack trace by clicking the copy button and pasting it somewhere.
This commit is contained in:
+16
-1
@@ -1,6 +1,7 @@
|
||||
// helper functions for React components
|
||||
|
||||
import React from 'react';
|
||||
import React, { useState } from 'react';
|
||||
import { createCountFunc } from './iter';
|
||||
|
||||
/**
|
||||
* Callback that can be passed to onContextMenu event handlers to prevent
|
||||
@@ -11,3 +12,17 @@ export const preventBrowserNativeContextMenu: React.MouseEventHandler = (e) =>
|
||||
|
||||
/** Style to disable pointer events. */
|
||||
export const pointerEventsNone: React.CSSProperties = { pointerEvents: 'none' };
|
||||
|
||||
const nextId = createCountFunc();
|
||||
|
||||
/**
|
||||
* React hook to get a unique identifier, e.g. for linking components via
|
||||
* aria-labelledby.
|
||||
*
|
||||
* @param prefix A namespace prefix for the identifier.
|
||||
* @returns A unique identifier in the form "prefix-N"
|
||||
*/
|
||||
export const useUniqueId = (prefix: string): string => {
|
||||
const [uniqueId] = useState(`${prefix}-${nextId()}`);
|
||||
return uniqueId;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user