jbilcke-hf HF staff commited on
Commit
3411c0f
1 Parent(s): 93ad82e

a reward for the most friendly users

Browse files
package-lock.json CHANGED
@@ -45,6 +45,7 @@
45
  "next-themes": "^0.2.1",
46
  "postcss": "8.4.38",
47
  "qs": "^6.12.1",
 
48
  "react": "18.3.1",
49
  "react-device-frameset": "^1.3.4",
50
  "react-dom": "18.3.1",
@@ -3621,6 +3622,14 @@
3621
  }
3622
  }
3623
  },
 
 
 
 
 
 
 
 
3624
  "node_modules/deep-is": {
3625
  "version": "0.1.4",
3626
  "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz",
@@ -4411,6 +4420,17 @@
4411
  "node": ">=8"
4412
  }
4413
  },
 
 
 
 
 
 
 
 
 
 
 
4414
  "node_modules/find-up": {
4415
  "version": "5.0.0",
4416
  "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz",
@@ -6290,6 +6310,22 @@
6290
  "url": "https://github.com/sponsors/ljharb"
6291
  }
6292
  },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6293
  "node_modules/queue-microtask": {
6294
  "version": "1.2.3",
6295
  "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz",
@@ -6844,6 +6880,17 @@
6844
  "node": ">=0.10.0"
6845
  }
6846
  },
 
 
 
 
 
 
 
 
 
 
 
6847
  "node_modules/streamsearch": {
6848
  "version": "1.1.0",
6849
  "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz",
 
45
  "next-themes": "^0.2.1",
46
  "postcss": "8.4.38",
47
  "qs": "^6.12.1",
48
+ "query-string": "^9.0.0",
49
  "react": "18.3.1",
50
  "react-device-frameset": "^1.3.4",
51
  "react-dom": "18.3.1",
 
3622
  }
3623
  }
3624
  },
3625
+ "node_modules/decode-uri-component": {
3626
+ "version": "0.4.1",
3627
+ "resolved": "https://registry.npmjs.org/decode-uri-component/-/decode-uri-component-0.4.1.tgz",
3628
+ "integrity": "sha512-+8VxcR21HhTy8nOt6jf20w0c9CADrw1O8d+VZ/YzzCt4bJ3uBjw+D1q2osAB8RnpwwaeYBxy0HyKQxD5JBMuuQ==",
3629
+ "engines": {
3630
+ "node": ">=14.16"
3631
+ }
3632
+ },
3633
  "node_modules/deep-is": {
3634
  "version": "0.1.4",
3635
  "resolved": "https://registry.npmjs.org/deep-is/-/deep-is-0.1.4.tgz",
 
4420
  "node": ">=8"
4421
  }
4422
  },
4423
+ "node_modules/filter-obj": {
4424
+ "version": "5.1.0",
4425
+ "resolved": "https://registry.npmjs.org/filter-obj/-/filter-obj-5.1.0.tgz",
4426
+ "integrity": "sha512-qWeTREPoT7I0bifpPUXtxkZJ1XJzxWtfoWWkdVGqa+eCr3SHW/Ocp89o8vLvbUuQnadybJpjOKu4V+RwO6sGng==",
4427
+ "engines": {
4428
+ "node": ">=14.16"
4429
+ },
4430
+ "funding": {
4431
+ "url": "https://github.com/sponsors/sindresorhus"
4432
+ }
4433
+ },
4434
  "node_modules/find-up": {
4435
  "version": "5.0.0",
4436
  "resolved": "https://registry.npmjs.org/find-up/-/find-up-5.0.0.tgz",
 
6310
  "url": "https://github.com/sponsors/ljharb"
6311
  }
6312
  },
6313
+ "node_modules/query-string": {
6314
+ "version": "9.0.0",
6315
+ "resolved": "https://registry.npmjs.org/query-string/-/query-string-9.0.0.tgz",
6316
+ "integrity": "sha512-4EWwcRGsO2H+yzq6ddHcVqkCQ2EFUSfDMEjF8ryp8ReymyZhIuaFRGLomeOQLkrzacMHoyky2HW0Qe30UbzkKw==",
6317
+ "dependencies": {
6318
+ "decode-uri-component": "^0.4.1",
6319
+ "filter-obj": "^5.1.0",
6320
+ "split-on-first": "^3.0.0"
6321
+ },
6322
+ "engines": {
6323
+ "node": ">=18"
6324
+ },
6325
+ "funding": {
6326
+ "url": "https://github.com/sponsors/sindresorhus"
6327
+ }
6328
+ },
6329
  "node_modules/queue-microtask": {
6330
  "version": "1.2.3",
6331
  "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz",
 
6880
  "node": ">=0.10.0"
6881
  }
6882
  },
6883
+ "node_modules/split-on-first": {
6884
+ "version": "3.0.0",
6885
+ "resolved": "https://registry.npmjs.org/split-on-first/-/split-on-first-3.0.0.tgz",
6886
+ "integrity": "sha512-qxQJTx2ryR0Dw0ITYyekNQWpz6f8dGd7vffGNflQQ3Iqj9NJ6qiZ7ELpZsJ/QBhIVAiDfXdag3+Gp8RvWa62AA==",
6887
+ "engines": {
6888
+ "node": ">=12"
6889
+ },
6890
+ "funding": {
6891
+ "url": "https://github.com/sponsors/sindresorhus"
6892
+ }
6893
+ },
6894
  "node_modules/streamsearch": {
6895
  "version": "1.1.0",
6896
  "resolved": "https://registry.npmjs.org/streamsearch/-/streamsearch-1.1.0.tgz",
package.json CHANGED
@@ -46,6 +46,7 @@
46
  "next-themes": "^0.2.1",
47
  "postcss": "8.4.38",
48
  "qs": "^6.12.1",
 
49
  "react": "18.3.1",
50
  "react-device-frameset": "^1.3.4",
51
  "react-dom": "18.3.1",
 
46
  "next-themes": "^0.2.1",
47
  "postcss": "8.4.38",
48
  "qs": "^6.12.1",
49
+ "query-string": "^9.0.0",
50
  "react": "18.3.1",
51
  "react-device-frameset": "^1.3.4",
52
  "react-dom": "18.3.1",
src/app/main.tsx CHANGED
@@ -26,6 +26,7 @@ import { Input } from '@/components/ui/input'
26
  import { Field } from '@/components/form/field'
27
  import { Label } from '@/components/form/label'
28
  import { VideoOrientation } from './types'
 
29
 
30
  export function Main() {
31
  const [_isPending, startTransition] = useTransition()
@@ -59,6 +60,8 @@ export function Main() {
59
  const saveClap = useStore(s => s.saveClap)
60
  const loadClap = useStore(s => s.loadClap)
61
 
 
 
62
  const hasPendingTasks =
63
  storyGenerationStatus === "generating" ||
64
  voiceGenerationStatus === "generating" ||
@@ -390,7 +393,7 @@ export function Main() {
390
  </Button>
391
  */}
392
 
393
- {/*
394
  <Button
395
  onClick={() => saveClap()}
396
  disabled={!currentClap || isBusy}
@@ -403,12 +406,10 @@ export function Main() {
403
  storyPromptDraft ? "opacity-100" : "opacity-80"
404
  )}
405
  >
406
- <span className="mr-1">Save preset</span>
407
- </Button>
408
- */}
409
- <div></div>
410
 
411
-
412
  <div className="
413
  flex flex-row
414
  justify-between items-center
 
26
  import { Field } from '@/components/form/field'
27
  import { Label } from '@/components/form/label'
28
  import { VideoOrientation } from './types'
29
+ import { getParam } from '@/lib/utils/getParam'
30
 
31
  export function Main() {
32
  const [_isPending, startTransition] = useTransition()
 
60
  const saveClap = useStore(s => s.saveClap)
61
  const loadClap = useStore(s => s.loadClap)
62
 
63
+ const canSeeBetaFeatures = getParam<boolean>("beta", false)
64
+
65
  const hasPendingTasks =
66
  storyGenerationStatus === "generating" ||
67
  voiceGenerationStatus === "generating" ||
 
393
  </Button>
394
  */}
395
 
396
+ {canSeeBetaFeatures ?
397
  <Button
398
  onClick={() => saveClap()}
399
  disabled={!currentClap || isBusy}
 
406
  storyPromptDraft ? "opacity-100" : "opacity-80"
407
  )}
408
  >
409
+ <span className="mr-1">Save project</span>
410
+ </Button> : <div></div>
411
+ }
 
412
 
 
413
  <div className="
414
  flex flex-row
415
  justify-between items-center
src/lib/utils/getParam.ts ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import queryString from 'query-string'
2
+
3
+ export function getParam<T>(name: string, defaultValue: T): T {
4
+ try {
5
+ const params = queryString.parseUrl(
6
+ typeof window !== "undefined" ? (window.location.href || "") : ""
7
+ )
8
+ const stringValue = params.query[name]?.toString() || `${defaultValue || ""}`
9
+ if (typeof defaultValue === "number") {
10
+ return Number(stringValue) as T
11
+ } else if (typeof defaultValue === "boolean") {
12
+ return Boolean(stringValue) as T
13
+ } else {
14
+ return stringValue as T
15
+ }
16
+ } catch (err) {
17
+ return defaultValue
18
+ }
19
+ }