Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SY-1093 Additional Schematic Symbols, SY-975 Fix Nested Button Element in Schematic #830

Open
wants to merge 27 commits into
base: rc
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
14d509f
[console] - updated additional symbols
emilbon99 Aug 18, 2024
f865d39
Merge branch 'rc' into sy-1093-additional-schematic-symbols
pjdotson Sep 14, 2024
da6cd06
fix(console): Fix nested <button> elements
pjdotson Sep 14, 2024
15a9365
feat(pluto): Add schematic symbols for agitators, arrows, text box, a…
pjdotson Sep 14, 2024
71f9953
[console] - experiments with focusing
emilbon99 Sep 16, 2024
5d23416
WIP on arrows
pjdotson Sep 16, 2024
162ebac
fix arrowhead
pjdotson Sep 16, 2024
48c9e0d
Merge branch 'rc' into sy-1093-additional-schematic-symbols
pjdotson Sep 16, 2024
85854c4
[console] - experimentation with additional schematic symbols
emilbon99 Sep 19, 2024
255878c
Merge branch 'rc' of https://github.com/synnaxlabs/synnax into sy-122…
emilbon99 Sep 19, 2024
77271d1
Merge branch 'rc' into sy-1093-additional-schematic-symbols
pjdotson Sep 20, 2024
b76b59b
[console] - ability to temp focus a layout
emilbon99 Sep 21, 2024
57d5e97
[client/py] - removed file
emilbon99 Sep 21, 2024
69c86dd
[pluto] - various improvements to symbols
emilbon99 Sep 22, 2024
19041b9
[pluto] - additional form definitions
emilbon99 Sep 22, 2024
d480c6b
Merge branch 'sy-1221-temporarily-focus-a-layout' of https://github.c…
emilbon99 Sep 22, 2024
f29c4fe
[pluto] - additional improvements to schematic symbols
emilbon99 Sep 22, 2024
f66321b
[console] - updated overview page
emilbon99 Sep 22, 2024
68187fa
[console] - improved collapse and expand tooling for multiple windows
emilbon99 Sep 23, 2024
085cd77
[console] - minor aesthetic adjustments
emilbon99 Sep 23, 2024
5084eb2
[console] - adjusted tab selector
emilbon99 Sep 23, 2024
0d4ec3e
[console] - adjustements to portal based rendering
emilbon99 Sep 23, 2024
895ea2e
Merge branch 'sy-1221-temporarily-focus-a-layout' of https://github.c…
emilbon99 Sep 26, 2024
0062755
[console] - adjusted setpoint styling
emilbon99 Sep 26, 2024
bf6e3ac
[console] - improved custom color button styling
emilbon99 Sep 26, 2024
992a12e
Merge branch 'rc' of https://github.com/synnaxlabs/synnax into sy-109…
emilbon99 Sep 26, 2024
252e4f7
remove blank files, console logs, set better default color on setpoint
pjdotson Sep 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions client/py/examples/control/tpc/optimization_auto.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def run_tpc(auto: Controller):

dual_press_end = sy.TimeStamp.now()
parent_rng.create_sub_range(
name=f"Dual Press Sequence",
name=f"Setup",
time_range=sy.TimeRange(dual_press_start, dual_press_end),
color="#D81E5B",
)
Expand Down Expand Up @@ -158,7 +158,7 @@ def run_tpc(auto: Controller):

press_tank_end = sy.TimeStamp.now()
parent_rng.create_sub_range(
name=f"Press Tank Pressurization",
name=f"Pressurization",
time_range=sy.TimeRange(press_tank_start, press_tank_end),
color="#1E90FF",
)
Expand All @@ -172,7 +172,7 @@ def run_tpc(auto: Controller):
print("Test complete. Safeing System")

rng = parent_rng.create_sub_range(
name=f"Bang Bang Sim",
name=f"Test",
time_range=sy.TimeRange(start, sy.TimeStamp.now()),
color="#bada55",
)
Expand Down
6 changes: 3 additions & 3 deletions console/src/layout/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,9 @@ export const selectFocused = (
state: StoreState & Drift.StoreState,
windowKey?: string,
): [string, string | null] => {
const window = selectWindow(state, windowKey);
if (window == null) throw new Error(`Window ${windowKey ?? ""} not found`);
return [window.key, selectSliceState(state).mosaics[window.key]?.focused ?? null];
const win = selectWindow(state, windowKey);
if (win == null) throw new Error(`Window ${windowKey ?? ""} not found`);
return [win.key, selectSliceState(state).mosaics[win.key]?.focused ?? null];
};

export const useSelectFocused = (): [string, string | null] =>
Expand Down
1 change: 1 addition & 0 deletions console/src/lineplot/toolbar/Axes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ export const LinePlotAxisControls = ({
bounds={{ lower: 1, upper: 200 }}
value={axis.tickSpacing}
onChange={handleTickSpacingChange}
endContent="px"
/>
</Input.Item>
</Align.Space>
Expand Down
2 changes: 1 addition & 1 deletion console/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@

import "@/index.css";
import "@synnaxlabs/media/dist/style.css";
import "@synnaxlabs/pluto/dist/style.css";

// import "@synnaxlabs/pluto/dist/style.css";
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be uncommented.

import { Provider } from "@synnaxlabs/drift/react";
import { type Haul, Pluto, type state, type Triggers } from "@synnaxlabs/pluto";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
Expand Down
1 change: 1 addition & 0 deletions console/src/schematic/Schematic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ const SymbolRenderer = ({

return (
<C.Symbol
id={symbolKey}
aetherKey={symbolKey}
position={position}
selected={selected}
Expand Down
1 change: 0 additions & 1 deletion console/src/schematic/toolbar/Symbols.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,6 @@ const SymbolsButton = ({
return (
// @ts-expect-error - generic elements
<Align.Space
el="button"
className={CSS.BE("schematic-symbols", "button")}
justify="spaceBetween"
align="center"
Expand Down
10 changes: 6 additions & 4 deletions pluto/src/align/Pack.css
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
--tl: var(--pluto-pack-br) 0 0 0;
--pluto-pack--middle: 0 !important;
--all: var(--pluto-pack-br);
--pluto-pack-border-width: 1px;

&.pluto--rounded {
--pluto-pack-br: var(--pluto-back-br, var(--pluto-border-radius));
Expand All @@ -32,6 +33,7 @@
&:not(.pluto-pack--shadow) > * {
border: var(--pluto-border);
border-color: var(--pluto-pack-border-shade);
border-width: var(--pluto-pack-border-width);
}

&.pluto-pack--shadow {
Expand All @@ -50,7 +52,7 @@
--pluto-pack--first: var(--l);
--pluto-pack--last: var(--r);
--pluto-pack--only: var(--all);
--pluto-pack--x-margin: 0 0 0 -1px !important;
--pluto-pack--x-margin: 0 0 0 calc(-1 * var(--pluto-pack-border-width)) !important;
--pluto-pack--x-first-y-first: var(--tl);
--pluto-pack--x-first-y-last: var(--bl);
--pluto-pack--x-first-y-only: var(--l);
Expand All @@ -61,7 +63,7 @@
.pluto-pack--reverse {
--pluto-pack--first: var(--r);
--pluto-pack--last: var(--l);
--pluto-pack--x-margin: 0 -1px 0 0 !important;
--pluto-pack--x-margin: 0 calc(-1 * var(--pluto-pack-border-width)) 0 0 !important;
--pluto-pack--x-first-y-first: var(--tr);
--pluto-pack--x-first-y-last: var(--br);
--pluto-pack--x-first-y-only: var(--r);
Expand Down Expand Up @@ -144,7 +146,7 @@
--pluto-pack--first: var(--t);
--pluto-pack--last: var(--b);
--pluto-pack--only: var(--all);
--pluto-pack--y-margin: -1px 0 0 0 !important;
--pluto-pack--y-margin: calc(-1 * var(--pluto-pack-border-width)) 0 0 0 !important;
--pluto-pack--y-first-x-first: var(--tl);
--pluto-pack--y-first-x-last: var(--tr);
--pluto-pack--y-first-x-only: var(--t);
Expand All @@ -155,7 +157,7 @@
&.pluto-pack--reverse {
--pluto-pack--first: 0 0 var(--pluto-pack-br) var(--pluto-pack-br) !important;
--pluto-pack--last: var(--pluto-pack-br) var(--pluto-pack-br) 0 0 !important;
--pluto-pack--y-margin: 0 0 -1px 0 !important;
--pluto-pack--y-margin: 0 0 calc(-1 * var(--pluto-pack-border-width)) 0 !important;
--pluto-pack--y-first-x-first: var(--bl);
--pluto-pack--y-first-x-last: var(--br);
--pluto-pack--y-first-x-only: var(--b);
Expand Down
60 changes: 35 additions & 25 deletions pluto/src/align/Pack.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ import { type ForwardedRef, forwardRef, type ReactElement } from "react";

import { Space, type SpaceElementType, type SpaceProps } from "@/align/Space";
import { CSS } from "@/css";
import { text } from "@/text/core";

/** Props for the {@link Pack} component. */
export type PackProps<E extends SpaceElementType = "div"> = Omit<
SpaceProps<E>,
"empty"
> & {
shadow?: boolean;
borderWidth?: number;
};

const CorePack = <E extends SpaceElementType = "div">(
Expand All @@ -29,38 +31,46 @@ const CorePack = <E extends SpaceElementType = "div">(
reverse = false,
direction = "x",
bordered = true,
borderShade = 3,
borderShade = 3 as text.Shade,
rounded = true,
shadow = false,
borderWidth,
style,
...props
}: PackProps<E>,
// select the correct type for the ref
ref: ForwardedRef<JSX.IntrinsicElements[E]>,
): ReactElement => (
// @ts-expect-error - generic element issues
<Space<E>
ref={ref}
direction={direction}
reverse={reverse}
className={CSS(
CSS.B("pack"),
shadow && CSS.BM("pack", "shadow"),
CSS.dir(direction),
typeof size !== "number" && CSS.BM("pack", size),
reverse && CSS.BM("pack", "reverse"),
className,
)}
style={{
...style,
[CSS.var("pack-border-shade")]: CSS.shadeVar(borderShade),
}}
bordered={bordered}
rounded={rounded}
{...props}
empty
/>
);
): ReactElement => {
const pStyle = {
[CSS.var("pack-border-shade")]: CSS.shadeVar(borderShade),
...style,
};
if (borderWidth != null)
// @ts-expect-error - generic element issues
pStyle[CSS.var("pack-border-width")] = `${borderWidth}px`;

return (
// @ts-expect-error - generic element issues
<Space<E>
ref={ref}
direction={direction}
reverse={reverse}
className={CSS(
CSS.B("pack"),
shadow && CSS.BM("pack", "shadow"),
CSS.dir(direction),
typeof size !== "number" && CSS.BM("pack", size),
reverse && CSS.BM("pack", "reverse"),
className,
)}
style={pStyle}
bordered={bordered}
rounded={rounded}
{...props}
empty
/>
);
};

/**
* Packs elements together, setting their size and styling the borders between them so
Expand Down
1 change: 1 addition & 0 deletions pluto/src/align/Space.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

.pluto-space {
display: flex;
border-color: var(--pluto-space-border-shade);
}

.pluto-space--medium {
Expand Down
44 changes: 38 additions & 6 deletions pluto/src/button/Button.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
}

.pluto-btn {
position: relative;
margin: 0;
cursor: pointer;
border-radius: var(--pluto-border-radius);
Expand All @@ -32,6 +33,22 @@
border-color 0.15s ease-in-out;
}

.pluto-btn__end-content {
position: absolute;
right: -0.5rem;
top: 0;
height: 100%;
display: flex;
align-items: center;
padding-right: 1.5rem;
pointer-events: none;
z-index: 0;
& > * {
color: var(--pluto-gray-l7);
transform: scale(0.8);
}
}

/* |||| FILLED |||| */

.pluto-btn--filled {
Expand All @@ -56,20 +73,20 @@
}

&.pluto-btn--custom-color {
--pluto-bg: rgba(var(--pluto-btn-color), 0.75);
--pluto-bg: rgba(var(--pluto-btn-color), 1);
background: var(--pluto-bg);
border-color: var(--pluto-bg) !important;
border-color: transparent !important;

&:hover:not(.pluto--disabled) {
--pluto-bg: rgba(var(--pluto-btn-color), 1);
--pluto-bg: rgba(var(--pluto-btn-color), 0.85);
background: var(--pluto-bg);
border-color: var(--pluto-bg) !important;
border-color: transparent !important;
}

&:active:not(.pluto--disabled) {
--pluto-bg: rgba(var(--pluto-btn-color), 0.6);
--pluto-bg: rgba(var(--pluto-btn-color), 0.7);
background: var(--pluto-bg);
border-color: var(--pluto-bg) !important;
border-color: transparent !important;
}
}

Expand Down Expand Up @@ -117,6 +134,21 @@
background: var(--pluto-bg);
border: var(--pluto-border-width) solid var(--pluto-gray-l4);

&.pluto-btn--custom-color {
--pluto-bg: rgba(var(--pluto-btn-color), 1);
border-color: var(--pluto-bg) !important;

&:hover:not(.pluto--disabled) {
--pluto-bg: rgba(var(--pluto-btn-color), 0.75);
border-color: var(--pluto-bg) !important;
}

&:active:not(.pluto--disabled) {
--pluto-bg: rgba(var(--pluto-btn-color), 1);
border-color: var(--pluto-bg) !important;
}
}

&.pluto--warning {
border-color: var(--pluto-warning-z) !important;
color: var(--pluto-warning-z);
Expand Down
17 changes: 15 additions & 2 deletions pluto/src/button/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@ import "@/button/Button.css";
import { Icon } from "@synnaxlabs/media";
import { TimeSpan } from "@synnaxlabs/x/telem";
import { toArray } from "@synnaxlabs/x/toArray";
import { type ComponentPropsWithoutRef, type ReactElement, useCallback } from "react";
import {
type ComponentPropsWithoutRef,
type ReactElement,
ReactNode,
useCallback,
} from "react";

import { type Align } from "@/align";
import { Color } from "@/color";
Expand Down Expand Up @@ -60,6 +65,7 @@ export type ButtonProps = Omit<
iconSpacing?: Align.SpaceProps["size"];
disabled?: boolean;
delay?: number | TimeSpan;
endContent?: ReactNode;
};

/**
Expand Down Expand Up @@ -95,6 +101,7 @@ export const Button = Tooltip.wrap(
color,
status,
style,
endContent,
...props
}: ButtonProps): ReactElement => {
if (loading) startIcon = [...toArray(startIcon), <Icon.Loading key="loader" />];
Expand Down Expand Up @@ -124,7 +131,8 @@ export const Button = Tooltip.wrap(

const pStyle = { ...style };
const res = Color.Color.z.safeParse(color);
const hasCustomColor = res.success && variant === "filled";
const hasCustomColor =
res.success && (variant === "filled" || variant === "outlined");
if (hasCustomColor) {
// @ts-expect-error - css variable
pStyle[CSS.var("btn-color")] = res.data.rgbString;
Expand Down Expand Up @@ -162,6 +170,11 @@ export const Button = Tooltip.wrap(
{...props}
>
{children}
{endContent != null ? (
<div className={CSS.BE("btn", "end-content")}>
{Text.formatChildren(level ?? Text.ComponentSizeLevels[size], endContent)}
</div>
) : undefined}
</Text.WithIcon>
);
},
Expand Down
4 changes: 3 additions & 1 deletion pluto/src/color/Swatch/Swatch.css
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@
aspect-ratio: 1.5;
transform: scale(0.8);

border-color: var(--pluto-gray-l4) !important;

&.pluto--no-border {
border-color: transparent;
}

&.pluto-haul-drop-region {
border: var(--pluto-border) !important;
border: var(--pluto-border-l4) !important;
border-color: var(--haul-border-color) !important;
background: var(--haul-background) !important;
}
Expand Down
Loading
Loading