@@ -36,6 +36,7 @@ const sampleResources: Array<Resource> = [
3636 {
3737 id : '1' ,
3838 label : 'Resource 1' ,
39+ capacity : 1 ,
3940 availability : [
4041 {
4142 weekdays : [ 1 , 2 , 3 ] ,
@@ -54,6 +55,23 @@ const sampleResources: Array<Resource> = [
5455 } ,
5556 ] ,
5657 } ,
58+ {
59+ id : '2' ,
60+ label : 'Resource 2' ,
61+ capacity : 1 ,
62+ availability : [
63+ {
64+ weekdays : [ 1 , 2 , 3 , 4 , 5 ] ,
65+ startTime : '12:00' ,
66+ endTime : '18:00' ,
67+ } ,
68+ {
69+ weekdays : [ 6 , 7 ] ,
70+ startTime : '00:00' ,
71+ endTime : '24:00' ,
72+ } ,
73+ ] ,
74+ } ,
5775]
5876
5977function getSampleEvents ( ) : Array < Event < Resource > > {
@@ -308,9 +326,40 @@ function ScheduleView({
308326 } = calendar
309327
310328 return (
311- < div className = "flex border border-neutral-800 rounded-lg overflow-hidden bg-black" >
312- < div className = "w-20 border-r border-neutral-800 bg-neutral-950" >
313- < div className = "h-12 border-b border-neutral-800" > </ div >
329+ < div className = "border border-neutral-800 rounded-lg overflow-hidden bg-black" >
330+ < div className = "border-b border-neutral-800 bg-neutral-950 px-4 py-3" >
331+ < div className = "flex gap-6 flex-wrap" >
332+ { sampleResources . map ( ( resource , idx ) => {
333+ const colors = [ '#0049af75' , '#00af3475' ]
334+ const color = colors [ idx % colors . length ]
335+ return (
336+ < div
337+ key = { resource . id }
338+ className = "flex items-center gap-2"
339+ >
340+ < div
341+ className = "w-4 h-4 rounded-sm"
342+ style = { {
343+ backgroundColor : color ,
344+ backgroundImage : `repeating-linear-gradient(315deg, ${ color } 0, ${ color } 1px, transparent 0, transparent 50%)` ,
345+ } }
346+ />
347+ < span className = "text-sm text-neutral-300" >
348+ { resource . label }
349+ </ span >
350+ { resource . capacity !== undefined && (
351+ < span className = "text-xs text-neutral-500" >
352+ (Capacity: { resource . capacity } )
353+ </ span >
354+ ) }
355+ </ div >
356+ )
357+ } ) }
358+ </ div >
359+ </ div >
360+ < div className = "flex border-t border-neutral-800" >
361+ < div className = "w-20 border-r border-neutral-800 bg-neutral-950" >
362+ < div className = "h-12 border-b border-neutral-800" > </ div >
314363 { timeSlots . map ( ( slot ) => (
315364 < div
316365 key = { `${ slot . hour } -${ slot . minute } ` }
@@ -348,19 +397,30 @@ function ScheduleView({
348397 </ div >
349398 </ div >
350399 < div className = "relative h-[1440px] bg-neutral-950/30" >
351- { getUnavailableRanges ( dayDate , { resourceIds : [ '1' ] } ) . map (
352- ( range , idx ) => (
400+ { sampleResources . map ( ( resource , resourceIdx ) => {
401+ const resourceRanges = getUnavailableRanges ( dayDate , {
402+ resourceIds : [ resource . id ] ,
403+ } )
404+ const colors = [
405+ '#0049af75' ,
406+ '#00af3475' ,
407+
408+ ]
409+ const color = colors [ resourceIdx % colors . length ]
410+
411+ return resourceRanges . map ( ( range , rangeIdx ) => (
353412 < div
354- key = { idx }
355- className = "absolute left-0 right-0 border-y border-neutral-800/50 pointer-events-none z-0 bg-[image:repeating-linear-gradient(315deg,_rgb(255_255_255_/_0.08)_0,_rgb(255_255_255_/_0.08)_1px,_transparent_0,_transparent_50%)] bg-[length:10px_10px] bg-fixed"
413+ key = { ` ${ resource . id } - ${ rangeIdx } ` }
414+ className = "absolute left-0 right-0 pointer-events-none z-0 bg-[length:10px_10px] bg-fixed"
356415 style = { {
357416 top : `${ range . top } px` ,
358417 height : `${ range . height } px` ,
418+ backgroundImage : `repeating-linear-gradient(315deg, ${ color } 0, ${ color } 1px, transparent 0, transparent 50%)` ,
359419 } }
360- title = " Unavailable"
420+ title = { ` Unavailable - ${ resource . label } ` }
361421 />
362- ) ,
363- ) }
422+ ) )
423+ } ) }
364424 { day . events . map ( ( event , eventIndex ) => {
365425 const eventProps = calendar . getEventProps ( event )
366426 const { style, isSplitEvent } = eventProps
@@ -503,6 +563,7 @@ function ScheduleView({
503563 </ div >
504564 </ div >
505565 </ div >
566+ </ div >
506567 </ div >
507568 )
508569}
0 commit comments