feat: wallpaper setup

This commit is contained in:
2025-12-04 00:53:35 -06:00
parent fe8dd92860
commit 2c1f89d23a
2 changed files with 27 additions and 1 deletions

View File

@@ -4,6 +4,7 @@ import { generateRandomId } from '../util/random';
import { Course } from './Course';
export interface Wallpaper {
type: string;
/** Image url will be here */
data?: string;
}

View File

@@ -28,6 +28,31 @@ import { LargeLogo } from '../common/LogoIcon';
import Text from '../common/Text/Text';
import CalendarFooter from './CalendarFooter';
import DiningAppPromo from './DiningAppPromo';
import { Wallpaper } from 'src/shared/types/UserSchedule';
function getWallpaper(wallpaper?: Wallpaper): React.CSSProperties {
if (!wallpaper || !wallpaper.data || wallpaper.type === 'none') {
return { backgroundColor: 'white' };
}
let imageUrl: string;
// get wallpaper image from storage, or just default to white
if (wallpaper.type === 'custom' && wallpaper.data) {
imageUrl = wallpaper.data;
} else {
// Fallback to white background
return { backgroundColor: 'white' };
}
return {
backgroundImage: `url(${imageUrl})`,
backgroundSize: 'cover',
backgroundPosition: 'center',
backgroundRepeat: 'no-repeat',
backgroundOrigin: 'border-box',
};
}
/**
* Calendar page component
@@ -96,7 +121,7 @@ export default function Calendar(): ReactNode {
return (
<CalendarContext.Provider value>
<div className='h-full w-full flex flex-col'>
<div className='h-full w-full flex flex-col' style={getWallpaper(activeSchedule.wallpaper)}>
<div className='screenshot:calendar-target h-screen flex overflow-auto'>
<div
className={clsx(