jbilcke-hf HF staff commited on
Commit
eae27f0
β€’
1 Parent(s): 6b27fdb

fix the jpg generator

Browse files
src/app/interface/page/index.tsx CHANGED
@@ -1,6 +1,7 @@
1
  import { allLayouts } from "@/app/layouts"
2
  import { useStore } from "@/app/store"
3
  import { cn } from "@/lib/utils"
 
4
 
5
  export function Page({ page }: { page: number }) {
6
  const zoomLevel = useStore(state => state.zoomLevel)
@@ -21,8 +22,18 @@ export function Page({ page }: { page: number }) {
21
  }, [prompt])
22
  */
23
 
 
 
 
 
 
 
 
 
 
24
  return (
25
  <div
 
26
  className={cn(
27
  `w-full`,
28
  // we are trying to reach a "book" look
 
1
  import { allLayouts } from "@/app/layouts"
2
  import { useStore } from "@/app/store"
3
  import { cn } from "@/lib/utils"
4
+ import { useEffect, useRef } from "react"
5
 
6
  export function Page({ page }: { page: number }) {
7
  const zoomLevel = useStore(state => state.zoomLevel)
 
22
  }, [prompt])
23
  */
24
 
25
+ const setPage = useStore(state => state.setPage)
26
+ const pageRef = useRef<HTMLDivElement>(null)
27
+
28
+ useEffect(() => {
29
+ const element = pageRef.current
30
+ if (!element) { return }
31
+ setPage(element)
32
+ }, [pageRef.current])
33
+
34
  return (
35
  <div
36
+ ref={pageRef}
37
  className={cn(
38
  `w-full`,
39
  // we are trying to reach a "book" look
src/app/interface/panel/index.tsx CHANGED
@@ -89,7 +89,7 @@ export function Panel({
89
  return
90
  }
91
  })
92
- }, 1000 * panel)
93
  }, [prompt, width, height])
94
 
95
 
 
89
  return
90
  }
91
  })
92
+ }, 2000 * panel)
93
  }, [prompt, width, height])
94
 
95
 
src/app/main.tsx CHANGED
@@ -41,17 +41,8 @@ export default function Main() {
41
 
42
  const zoomLevel = useStore(state => state.zoomLevel)
43
 
44
- const setPage = useStore(state => state.setPage)
45
- const pageRef = useRef<HTMLDivElement>(null)
46
-
47
  const [waitABitMore, setWaitABitMore] = useState(false)
48
 
49
- useEffect(() => {
50
- const element = pageRef.current
51
- if (!element) { return }
52
- setPage(element)
53
- }, [pageRef.current])
54
-
55
  // react to URL params
56
  useEffect(() => {
57
  if (requestedPreset && requestedPreset !== preset.label) { setPreset(getPreset(requestedPreset)) }
@@ -121,7 +112,6 @@ export default function Main() {
121
  fonts.actionman.className
122
  )}>
123
  <div
124
- ref={pageRef}
125
  className={cn(
126
  `flex flex-col w-full`,
127
  zoomLevel > 105 ? `items-start` : `items-center`
 
41
 
42
  const zoomLevel = useStore(state => state.zoomLevel)
43
 
 
 
 
44
  const [waitABitMore, setWaitABitMore] = useState(false)
45
 
 
 
 
 
 
 
46
  // react to URL params
47
  useEffect(() => {
48
  if (requestedPreset && requestedPreset !== preset.label) { setPreset(getPreset(requestedPreset)) }
 
112
  fonts.actionman.className
113
  )}>
114
  <div
 
115
  className={cn(
116
  `flex flex-col w-full`,
117
  zoomLevel > 105 ? `items-start` : `items-center`