chore(react/collections): reintroduce geomap touch bar buttons

This commit is contained in:
Elian Doran
2025-09-06 14:31:41 +03:00
parent 6bd548cc22
commit 4c20ac0b1c
2 changed files with 43 additions and 13 deletions

View File

@@ -8,6 +8,24 @@ interface TouchBarProps {
children: ComponentChildren;
}
interface LabelProps {
label: string;
}
interface SliderProps {
label: string;
value: number;
minValue: number;
maxValue: number;
onChange: (newValue: number) => void;
}
interface ButtonProps {
label: string;
click: () => void;
enabled?: boolean;
}
interface TouchBarContextApi {
addItem(item: TouchBarItem): void;
TouchBar: typeof Electron.TouchBar;
@@ -61,7 +79,7 @@ export default function TouchBar({ children }: TouchBarProps) {
);
}
export function TouchBarLabel({ label }: { label: string }) {
export function TouchBarLabel({ label }: LabelProps) {
const api = useContext(TouchBarContext);
if (api) {
@@ -74,14 +92,6 @@ export function TouchBarLabel({ label }: { label: string }) {
return <></>;
}
interface SliderProps {
label: string;
value: number;
minValue: number;
maxValue: number;
onChange: (newValue: number) => void;
}
export function TouchBarSlider({ label, value, minValue, maxValue, onChange }: SliderProps) {
const api = useContext(TouchBarContext);
@@ -96,3 +106,16 @@ export function TouchBarSlider({ label, value, minValue, maxValue, onChange }: S
return <></>;
}
export function TouchBarButton({ label, click, enabled }: ButtonProps) {
const api = useContext(TouchBarContext);
if (api) {
const item = new api.TouchBar.TouchBarButton({
label, click, enabled
});
api.addItem(item);
}
return <></>;
}