diff --git a/frontend/src/bundles/studio/components/components.ts b/frontend/src/bundles/studio/components/components.ts index e703168d6..b65c32d69 100644 --- a/frontend/src/bundles/studio/components/components.ts +++ b/frontend/src/bundles/studio/components/components.ts @@ -1,3 +1,4 @@ +export { Control } from './control/control.js'; export { PlayerControls } from './player-controls/player-controls.js'; export { Timeline } from './timeline/timeline.js'; export { VideoComponent } from './video/video.js'; diff --git a/frontend/src/bundles/studio/components/player-controls/components/control/control.tsx b/frontend/src/bundles/studio/components/control/control.tsx similarity index 70% rename from frontend/src/bundles/studio/components/player-controls/components/control/control.tsx rename to frontend/src/bundles/studio/components/control/control.tsx index fac88d065..65acadb22 100644 --- a/frontend/src/bundles/studio/components/player-controls/components/control/control.tsx +++ b/frontend/src/bundles/studio/components/control/control.tsx @@ -12,6 +12,10 @@ type Properties = { size: IconSizeT; icon: ElementType; onClick?: () => void; + width?: string; + height?: string; + isRound?: boolean; + variant?: string; }; const Control: React.FC = ({ @@ -19,14 +23,20 @@ const Control: React.FC = ({ size, icon, onClick = (): void => {}, + width, + height, + isRound = true, + variant = 'gray', }) => { return ( } onClick={onClick} /> diff --git a/frontend/src/bundles/studio/components/player-controls/components/components.ts b/frontend/src/bundles/studio/components/player-controls/components/components.ts index cc3c790ed..fc95b8d04 100644 --- a/frontend/src/bundles/studio/components/player-controls/components/components.ts +++ b/frontend/src/bundles/studio/components/player-controls/components/components.ts @@ -1,2 +1 @@ -export { Control } from './control/control.js'; export { TimeDisplay } from './time-display/time-display.js'; diff --git a/frontend/src/bundles/studio/components/player-controls/player-controls.tsx b/frontend/src/bundles/studio/components/player-controls/player-controls.tsx index e51699d21..347f5b5e6 100644 --- a/frontend/src/bundles/studio/components/player-controls/player-controls.tsx +++ b/frontend/src/bundles/studio/components/player-controls/player-controls.tsx @@ -13,7 +13,8 @@ import { setItemsSpan } from '~/bundles/studio/helpers/set-items-span.js'; import { selectTotalDuration } from '~/bundles/studio/store/selectors.js'; import { actions as studioActions } from '~/bundles/studio/store/studio.js'; -import { Control, TimeDisplay } from './components/components.js'; +import { Control } from '../components.js'; +import { TimeDisplay } from './components/components.js'; const PlayerControls: React.FC = () => { const dispatch = useAppDispatch(); diff --git a/frontend/src/bundles/studio/components/timeline/rows/scenes-row.tsx b/frontend/src/bundles/studio/components/timeline/rows/scenes-row.tsx index c3bbbc129..df1b31749 100644 --- a/frontend/src/bundles/studio/components/timeline/rows/scenes-row.tsx +++ b/frontend/src/bundles/studio/components/timeline/rows/scenes-row.tsx @@ -1,7 +1,13 @@ import { Badge, Image } from '~/bundles/common/components/components.js'; import { useAppSelector, useMemo } from '~/bundles/common/hooks/hooks.js'; +import { IconName, IconSize } from '~/bundles/common/icons/icons.js'; +import { Control } from '~/bundles/studio/components/components.js'; import { RowNames } from '~/bundles/studio/enums/enums.js'; -import { setItemsSpan } from '~/bundles/studio/helpers/set-items-span.js'; +import { + getElementEnd, + setItemsSpan, +} from '~/bundles/studio/helpers/helpers.js'; +import { useTimelineContext } from '~/bundles/studio/hooks/hooks.js'; import styles from '~/framework/theme/styles/css-modules/timeline.module.css'; import { Item, Row } from '../components.js'; @@ -9,6 +15,15 @@ import { Item, Row } from '../components.js'; const ScenesRow: React.FC = () => { const scenes = useAppSelector(({ studio }) => studio.scenes); const scenesWithSpan = useMemo(() => setItemsSpan(scenes), [scenes]); + const { pixelsToValue } = useTimelineContext(); + + const scenesEnd = scenesWithSpan.at(-1)?.span.end ?? 0; + const buttonWidthInPixels = 60; + + const buttonEnd = getElementEnd( + scenesEnd, + pixelsToValue(buttonWidthInPixels), + ); return ( { )} ))} + + + + ); }; diff --git a/frontend/src/bundles/studio/components/timeline/rows/scripts-row.tsx b/frontend/src/bundles/studio/components/timeline/rows/scripts-row.tsx index ce788f8f0..98b0e21c0 100644 --- a/frontend/src/bundles/studio/components/timeline/rows/scripts-row.tsx +++ b/frontend/src/bundles/studio/components/timeline/rows/scripts-row.tsx @@ -1,13 +1,28 @@ import { Text } from '~/bundles/common/components/components.js'; import { useAppSelector, useMemo } from '~/bundles/common/hooks/hooks.js'; +import { IconName, IconSize } from '~/bundles/common/icons/icons.js'; +import { Control } from '~/bundles/studio/components/components.js'; import { RowNames } from '~/bundles/studio/enums/enums.js'; -import { setItemsSpan } from '~/bundles/studio/helpers/set-items-span.js'; +import { + getElementEnd, + setItemsSpan, +} from '~/bundles/studio/helpers/helpers.js'; +import { useTimelineContext } from '~/bundles/studio/hooks/hooks.js'; import { Item, Row } from '../components.js'; const ScriptsRow: React.FC = () => { const scripts = useAppSelector(({ studio }) => studio.scripts); const scriptsWithSpan = useMemo(() => setItemsSpan(scripts), [scripts]); + const { pixelsToValue } = useTimelineContext(); + + const scriptsEnd = scriptsWithSpan.at(-1)?.span.end ?? 0; + const buttonWidthInPixels = 100; + + const buttonEnd = getElementEnd( + scriptsEnd, + pixelsToValue(buttonWidthInPixels), + ); return ( { ))} + + + + ); }; diff --git a/frontend/src/bundles/studio/helpers/get-element-end.ts b/frontend/src/bundles/studio/helpers/get-element-end.ts new file mode 100644 index 000000000..a1c4e392c --- /dev/null +++ b/frontend/src/bundles/studio/helpers/get-element-end.ts @@ -0,0 +1,5 @@ +const getElementEnd = (itemsEnd: number, elementWidth: number): number => { + return itemsEnd + (Number.isFinite(elementWidth) ? elementWidth : 0); +}; + +export { getElementEnd }; diff --git a/frontend/src/bundles/studio/helpers/helpers.ts b/frontend/src/bundles/studio/helpers/helpers.ts index c0715a121..63038aa62 100644 --- a/frontend/src/bundles/studio/helpers/helpers.ts +++ b/frontend/src/bundles/studio/helpers/helpers.ts @@ -1,4 +1,5 @@ export { getDestinationPointerValue } from './get-destination-pointer-value.js'; +export { getElementEnd } from './get-element-end.js'; export { getNewItemIndexBySpan } from './get-new-item-index.js'; export { reorderItemsByIndexes } from './reorder-items.js'; export { setItemsSpan } from './set-items-span.js'; diff --git a/frontend/src/framework/theme/styles/components.styles.ts b/frontend/src/framework/theme/styles/components.styles.ts index 056926866..b9be1c43f 100644 --- a/frontend/src/framework/theme/styles/components.styles.ts +++ b/frontend/src/framework/theme/styles/components.styles.ts @@ -80,6 +80,10 @@ const components = { color: colors.typography[600], bgColor: colors.background[50], }, + light: { + color: colors.background[50], + bgColor: colors.white, + }, primaryOutlined: { color: colors.background[300], border: '1px solid',