Rename bgStyle to 'background'

This commit is contained in:
Robin
2026-07-08 14:01:38 +02:00
parent bebe79d109
commit 27315a7090
6 changed files with 25 additions and 25 deletions

View File

@@ -21,7 +21,7 @@ spotlight tile is maximised and displaying video, apply a gradient background. *
.overflowing > .footer, .overflowing > .footer,
.fixedGrid:has( .fixedGrid:has(
> .tile[data-maximised="true"] > .tile[data-maximised="true"]
.spotlightItem[data-bg-style="transparent"][data-video-enabled="true"][aria-hidden="false"] .spotlightItem[data-background="transparent"][data-video-enabled="true"][aria-hidden="false"]
) )
~ .footer { ~ .footer {
background: linear-gradient( background: linear-gradient(

View File

@@ -15,7 +15,7 @@ import { type MediaViewModel } from "./media/MediaViewModel";
import { type UserMediaViewModel } from "./media/UserMediaViewModel"; import { type UserMediaViewModel } from "./media/UserMediaViewModel";
import { type RingingMediaViewModel } from "./media/RingingMediaViewModel"; import { type RingingMediaViewModel } from "./media/RingingMediaViewModel";
type BackgroundStyle = "solid" | "transparent"; type SpotlightBackground = "solid" | "transparent";
function debugEntries(entries: GridTileData[]): string[] { function debugEntries(entries: GridTileData[]): string[] {
return entries.map((e) => e.media.displayName$.value); return entries.map((e) => e.media.displayName$.value);
@@ -41,12 +41,12 @@ class SpotlightTileData {
this.maximised$.next(value); this.maximised$.next(value);
} }
private readonly bgStyle$: BehaviorSubject<BackgroundStyle>; private readonly background$: BehaviorSubject<SpotlightBackground>;
public get bgStyle(): BackgroundStyle { public get background(): SpotlightBackground {
return this.bgStyle$.value; return this.background$.value;
} }
public set bgStyle(value: BackgroundStyle) { public set background(value: SpotlightBackground) {
this.bgStyle$.next(value); this.background$.next(value);
} }
public readonly vm: SpotlightTileViewModel; public readonly vm: SpotlightTileViewModel;
@@ -54,15 +54,15 @@ class SpotlightTileData {
public constructor( public constructor(
media: MediaViewModel[], media: MediaViewModel[],
maximised: boolean, maximised: boolean,
bgStyle: BackgroundStyle, background: SpotlightBackground,
) { ) {
this.media$ = new BehaviorSubject(media); this.media$ = new BehaviorSubject(media);
this.maximised$ = new BehaviorSubject(maximised); this.maximised$ = new BehaviorSubject(maximised);
this.bgStyle$ = new BehaviorSubject(bgStyle); this.background$ = new BehaviorSubject(background);
this.vm = new SpotlightTileViewModel( this.vm = new SpotlightTileViewModel(
this.media$, this.media$,
this.maximised$, this.maximised$,
this.bgStyle$, this.background$,
); );
} }
} }
@@ -179,7 +179,7 @@ export class TileStoreBuilder {
public registerSpotlight( public registerSpotlight(
media: MediaViewModel[], media: MediaViewModel[],
maximised: boolean, maximised: boolean,
bgStyle: BackgroundStyle = "solid", background: SpotlightBackground = "solid",
): void { ): void {
if (DEBUG_ENABLED) if (DEBUG_ENABLED)
logger.debug( logger.debug(
@@ -192,12 +192,12 @@ export class TileStoreBuilder {
// Reuse the previous spotlight tile if it exists // Reuse the previous spotlight tile if it exists
if (this.prevSpotlight === null) { if (this.prevSpotlight === null) {
this.spotlight = new SpotlightTileData(media, maximised, bgStyle); this.spotlight = new SpotlightTileData(media, maximised, background);
} else { } else {
this.spotlight = this.prevSpotlight; this.spotlight = this.prevSpotlight;
this.spotlight.media = media; this.spotlight.media = media;
this.spotlight.maximised = maximised; this.spotlight.maximised = maximised;
this.spotlight.bgStyle = bgStyle; this.spotlight.background = background;
} }
} }

View File

@@ -37,7 +37,7 @@ export class SpotlightTileViewModel {
public constructor( public constructor(
public readonly media$: Behavior<MediaViewModel[]>, public readonly media$: Behavior<MediaViewModel[]>,
public readonly maximised$: Behavior<boolean>, public readonly maximised$: Behavior<boolean>,
public readonly bgStyle$: Behavior<"solid" | "transparent">, public readonly background$: Behavior<"solid" | "transparent">,
) {} ) {}
} }

View File

@@ -51,7 +51,7 @@ Please see LICENSE in the repository root for full details.
contain: strict; contain: strict;
} }
.media[data-bg-style="solid"] .bg { .media[data-background="solid"] .bg {
background-color: var(--video-tile-background); background-color: var(--video-tile-background);
} }

View File

@@ -44,7 +44,7 @@ interface Props extends ComponentProps<typeof animated.div> {
displayName: string; displayName: string;
mxcAvatarUrl: string | undefined; mxcAvatarUrl: string | undefined;
avatarStyle?: "solid" | "translucent"; avatarStyle?: "solid" | "translucent";
bgStyle?: "solid" | "transparent"; background?: "solid" | "transparent";
focusable: boolean; focusable: boolean;
primaryButton?: ReactNode; primaryButton?: ReactNode;
raisedHandTime?: Date; raisedHandTime?: Date;
@@ -76,7 +76,7 @@ export const MediaView: FC<Props> = ({
displayName, displayName,
mxcAvatarUrl, mxcAvatarUrl,
avatarStyle = "solid", avatarStyle = "solid",
bgStyle = "solid", background = "solid",
focusable, focusable,
primaryButton, primaryButton,
status, status,
@@ -126,7 +126,7 @@ export const MediaView: FC<Props> = ({
data-testid="videoTile" data-testid="videoTile"
data-video-enabled={video && videoEnabled} data-video-enabled={video && videoEnabled}
data-video-fit={videoFit} data-video-fit={videoFit}
data-bg-style={bgStyle} data-background={background}
{...props} {...props}
> >
<div className={styles.bg}> <div className={styles.bg}>

View File

@@ -65,7 +65,7 @@ interface SpotlightItemBaseProps {
displayName: string; displayName: string;
mxcAvatarUrl: string | undefined; mxcAvatarUrl: string | undefined;
showNameTags: boolean; showNameTags: boolean;
bgStyle: "solid" | "transparent"; background: "solid" | "transparent";
focusable: boolean; focusable: boolean;
"aria-hidden"?: boolean; "aria-hidden"?: boolean;
} }
@@ -135,7 +135,7 @@ const SpotlightUserMediaItem: FC<SpotlightUserMediaItemProps> = ({
RefAttributes<HTMLDivElement> = { RefAttributes<HTMLDivElement> = {
videoFit, videoFit,
videoEnabled, videoEnabled,
soundWaves: props.bgStyle === "transparent" ? speaking : undefined, soundWaves: props.background === "transparent" ? speaking : undefined,
targetWidth, targetWidth,
targetHeight, targetHeight,
...props, ...props,
@@ -247,7 +247,7 @@ interface SpotlightItemProps {
targetHeight: number; targetHeight: number;
showNameTags: boolean; showNameTags: boolean;
showRingingStatus: boolean; showRingingStatus: boolean;
bgStyle: "solid" | "transparent"; background: "solid" | "transparent";
focusable: boolean; focusable: boolean;
intersectionObserver$: Observable<IntersectionObserver>; intersectionObserver$: Observable<IntersectionObserver>;
/** /**
@@ -265,7 +265,7 @@ const SpotlightItem: FC<SpotlightItemProps> = ({
targetHeight, targetHeight,
showNameTags, showNameTags,
showRingingStatus, showRingingStatus,
bgStyle, background,
focusable, focusable,
intersectionObserver$, intersectionObserver$,
snap, snap,
@@ -303,7 +303,7 @@ const SpotlightItem: FC<SpotlightItemProps> = ({
displayName, displayName,
mxcAvatarUrl, mxcAvatarUrl,
showNameTags, showNameTags,
bgStyle, background,
focusable, focusable,
"aria-hidden": ariaHidden, "aria-hidden": ariaHidden,
}; };
@@ -426,7 +426,7 @@ export const SpotlightTile: FC<Props> = ({
const [ourRef, root$] = useObservableRef<HTMLDivElement | null>(null); const [ourRef, root$] = useObservableRef<HTMLDivElement | null>(null);
const ref = useMergedRefs(ourRef, theirRef); const ref = useMergedRefs(ourRef, theirRef);
const maximised = useBehavior(vm.maximised$); const maximised = useBehavior(vm.maximised$);
const bgStyle = useBehavior(vm.bgStyle$); const background = useBehavior(vm.background$);
const media = useBehavior(vm.media$); const media = useBehavior(vm.media$);
const [visibleId, setVisibleId] = useState<string | undefined>(media[0]?.id); const [visibleId, setVisibleId] = useState<string | undefined>(media[0]?.id);
const latestMedia = useLatest(media); const latestMedia = useLatest(media);
@@ -530,7 +530,7 @@ export const SpotlightTile: FC<Props> = ({
targetHeight={targetHeight} targetHeight={targetHeight}
showRingingStatus={showRingingStatus} showRingingStatus={showRingingStatus}
showNameTags={showNameTags} showNameTags={showNameTags}
bgStyle={bgStyle} background={background}
focusable={focusable} focusable={focusable}
intersectionObserver$={intersectionObserver$} intersectionObserver$={intersectionObserver$}
// This is how we get the container to scroll to the right media // This is how we get the container to scroll to the right media