File tree Expand file tree Collapse file tree 4 files changed +38
-15
lines changed
2025/schedule/_components Expand file tree Collapse file tree 4 files changed +38
-15
lines changed Original file line number Diff line number Diff line change @@ -97,14 +97,18 @@ export function ResetFiltersButton({
97
97
} ) {
98
98
const hasFilters = Object . values ( filters ) . flat ( ) . length > 0
99
99
100
+ if ( ! hasFilters ) {
101
+ return null
102
+ }
103
+
100
104
return (
101
105
< Button
102
106
variant = "tertiary"
103
107
title = "Reset filters"
104
108
onClick = { onReset }
105
109
disabled = { ! hasFilters }
106
110
className = { clsx (
107
- "h-fit items-center gap-x-2 bg-neu-100 !p-2 text-neu-700 transition-opacity hover:bg-neu-200/80 hover:text-neu-900 disabled:opacity-0 " ,
111
+ "h-fit items-center gap-x-2 bg-neu-100 !p-2 text-neu-700 transition-opacity hover:bg-neu-200/80 hover:text-neu-900" ,
108
112
className ,
109
113
) }
110
114
>
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ import {
18
18
} from "./filters"
19
19
import { formatBlockTime } from "./format-block-time"
20
20
import { useCurrentTimeMarker } from "./use-current-time-marker"
21
+ import { Button } from "@/app/conf/_design-system/button"
21
22
22
23
export interface FiltersConfig
23
24
extends Partial <
@@ -139,23 +140,32 @@ export function ScheduleList({
139
140
const firstDayIsDayZero = Object . keys ( firstDay ) . length < 3
140
141
const startIndex = firstDayIsDayZero ? 0 : 1
141
142
142
- const getTimeMarker = useCurrentTimeMarker ( )
143
+ const { getTimeMarker } = useCurrentTimeMarker ( )
143
144
144
145
return (
145
146
< >
146
147
< div className = "flex justify-between gap-1 max-lg:flex-col" >
147
148
< BookmarkOnSched year = { year } />
148
- < ResetFiltersButton
149
- filters = { filtersState }
150
- onReset = { ( ) =>
151
- setFiltersState (
152
- FilterStates . initial (
153
- Object . keys ( filterFields ) as ( keyof ScheduleSession ) [ ] ,
154
- ) ,
155
- )
156
- }
157
- className = "max-lg:mb-4 max-lg:w-fit max-lg:self-end"
158
- />
149
+ < div className = "flex gap-2" >
150
+ < Button
151
+ href = "#current-time-marker"
152
+ variant = "tertiary"
153
+ className = "hidden h-fit items-center gap-x-2 bg-neu-100 !p-2 text-neu-700 transition-opacity hover:bg-neu-200/80 hover:text-neu-900 disabled:opacity-0 [body:has(#current-time-marker)_&]:flex"
154
+ >
155
+ Scroll to current block
156
+ </ Button >
157
+ < ResetFiltersButton
158
+ filters = { filtersState }
159
+ onReset = { ( ) =>
160
+ setFiltersState (
161
+ FilterStates . initial (
162
+ Object . keys ( filterFields ) as ( keyof ScheduleSession ) [ ] ,
163
+ ) ,
164
+ )
165
+ }
166
+ className = "max-lg:mb-4 max-lg:w-fit max-lg:self-end"
167
+ />
168
+ </ div >
159
169
</ div >
160
170
{ showFilter && (
161
171
< Filters
Original file line number Diff line number Diff line change @@ -41,5 +41,5 @@ export function useCurrentTimeMarker() {
41
41
}
42
42
}
43
43
44
- return getTimeMarker
44
+ return { getTimeMarker }
45
45
}
Original file line number Diff line number Diff line change @@ -26,7 +26,16 @@ export const Anchor = forwardRef(function Anchor(
26
26
return isInternal ( props ) ? (
27
27
< NextLink { ...props } ref = { ref } />
28
28
) : (
29
- < a ref = { ref } rel = "noopener noreferrer" target = "_blank" { ...props } />
29
+ < a
30
+ ref = { ref }
31
+ { ...( ! props . href . startsWith ( "#" )
32
+ ? {
33
+ rel : "noopener noreferrer" ,
34
+ target : "_blank" ,
35
+ }
36
+ : { } ) }
37
+ { ...props }
38
+ />
30
39
)
31
40
} ) as ( props : AnchorProps ) => ReactElement
32
41
You can’t perform that action at this time.
0 commit comments