1
+ // @refresh reset
1
2
import type { NextPage } from "next" ;
2
3
import { useSession } from "next-auth/react" ;
3
4
import { useRouter } from "next/router" ;
@@ -10,12 +11,22 @@ import JoinRoom from "~/components/join";
10
11
import Image from "next/image" ;
11
12
import Features from "~/components/features" ;
12
13
import CharacterAnimation from "~/components/animation/character" ;
14
+ import { useRive , Layout , Fit , Alignment } from "@rive-app/react-canvas" ;
13
15
14
16
function ConnectionTab ( ) {
15
17
const { data : session , status } = useSession ( ) ;
16
18
const createRoom = api . rooms . createRoom . useMutation ( ) ;
17
19
const router = useRouter ( ) ;
20
+ const { RiveComponent : Hero } = useRive ( {
21
+ src : `hero.riv` ,
22
+ stateMachines : [ "State Machine 1" ] ,
23
+ autoplay : true ,
24
+ layout : new Layout ( {
25
+ fit : Fit . FitWidth ,
18
26
27
+ alignment : Alignment . Center ,
28
+ } ) ,
29
+ } ) ;
19
30
const createRoomHandler = async ( ) => {
20
31
const data = await createRoom . mutateAsync ( ) ;
21
32
router . push ( `/rooms/${ data . roomName } ` ) ;
@@ -26,93 +37,89 @@ function ConnectionTab() {
26
37
return (
27
38
< >
28
39
< Navbar status = { status } session = { session } />
29
- < div className = "isolate flex h-screen w-screen flex-col items-center justify-center space-y-4 p-5 text-center md:flex-row" >
30
- < div className = "absolute inset-x-0 top-[-10rem] -z-10 transform-gpu overflow-hidden opacity-60 blur-3xl sm:top-[-20rem]" >
31
- < svg
32
- className = "relative left-[calc(50%-11rem)] -z-10 h-[21.1875rem] max-w-none -translate-x-1/2 rotate-[30deg] sm:left-[calc(50%-30rem)] sm:h-[42.375rem]"
33
- viewBox = "0 0 1155 678"
34
- fill = "none"
35
- xmlns = "http://www.w3.org/2000/svg"
36
- >
37
- < path
38
- fill = "url(#45de2b6b-92d5-4d68-a6a0-9b9b2abad533)"
39
- fillOpacity = ".3"
40
- d = "M317.219 518.975L203.852 678 0 438.341l317.219 80.634 204.172-286.402c1.307 132.337 45.083 346.658 209.733 145.248C936.936 126.058 882.053-94.234 1031.02 41.331c119.18 108.451 130.68 295.337 121.53 375.223L855 299l21.173 362.054-558.954-142.079z"
41
- />
42
- < defs >
43
- < linearGradient
44
- id = "45de2b6b-92d5-4d68-a6a0-9b9b2abad533"
45
- x1 = "1155.49"
46
- x2 = "-78.208"
47
- y1 = ".177"
48
- y2 = "474.645"
49
- gradientUnits = "userSpaceOnUse"
50
- >
51
- < stop stopColor = "#9089FC" />
52
- < stop offset = { 1 } stopColor = "#FF80B5" />
53
- </ linearGradient >
54
- </ defs >
55
- </ svg >
56
- </ div >
40
+ < main className = "overflow-hidden" >
41
+ < div className = "isolate flex h-screen w-screen flex-col items-center justify-center space-y-4 p-5 text-center md:flex-row" >
42
+ < div className = "absolute inset-x-0 top-[-10rem] -z-10 transform-gpu overflow-hidden opacity-60 blur-3xl sm:top-[-20rem]" >
43
+ < svg
44
+ className = "relative left-[calc(50%-11rem)] -z-10 h-[21.1875rem] max-w-none -translate-x-1/2 rotate-[30deg] sm:left-[calc(50%-30rem)] sm:h-[42.375rem]"
45
+ viewBox = "0 0 1155 678"
46
+ fill = "none"
47
+ xmlns = "http://www.w3.org/2000/svg"
48
+ >
49
+ < path
50
+ fill = "url(#45de2b6b-92d5-4d68-a6a0-9b9b2abad533)"
51
+ fillOpacity = ".3"
52
+ d = "M317.219 518.975L203.852 678 0 438.341l317.219 80.634 204.172-286.402c1.307 132.337 45.083 346.658 209.733 145.248C936.936 126.058 882.053-94.234 1031.02 41.331c119.18 108.451 130.68 295.337 121.53 375.223L855 299l21.173 362.054-558.954-142.079z"
53
+ />
54
+ < defs >
55
+ < linearGradient
56
+ id = "45de2b6b-92d5-4d68-a6a0-9b9b2abad533"
57
+ x1 = "1155.49"
58
+ x2 = "-78.208"
59
+ y1 = ".177"
60
+ y2 = "474.645"
61
+ gradientUnits = "userSpaceOnUse"
62
+ >
63
+ < stop stopColor = "#9089FC" />
64
+ < stop offset = { 1 } stopColor = "#FF80B5" />
65
+ </ linearGradient >
66
+ </ defs >
67
+ </ svg >
68
+ </ div >
57
69
58
- < div className = "w-full max-w-md space-y-4" >
59
- < Typing />
70
+ < div className = "w-full max-w-md space-y-4" >
71
+ < Typing />
60
72
61
- < CharacterAnimation
62
- className = "flex justify-center"
63
- textStyle = "text-sm text-gray-400"
64
- text = "Multilingual Video Conferencing App"
65
- />
73
+ < CharacterAnimation
74
+ className = "flex justify-center"
75
+ textStyle = "text-sm text-gray-400"
76
+ text = "Multilingual Video Conferencing App"
77
+ />
66
78
67
- < div className = "flex flex-col items-center space-y-4 lg:flex-row lg:space-y-0 lg:space-x-4" >
68
- < button onClick = { createRoomHandler } className = "lk-button h-fit" >
69
- < AiOutlineVideoCameraAdd />
70
- < CharacterAnimation text = "Create Room" textStyle = "text-sm" />
71
- </ button >
79
+ < div className = "flex flex-col items-center space-y-4 lg:flex-row lg:space-y-0 lg:space-x-4" >
80
+ < button onClick = { createRoomHandler } className = "lk-button h-fit" >
81
+ < AiOutlineVideoCameraAdd />
82
+ < CharacterAnimation text = "Create Room" textStyle = "text-sm" />
83
+ </ button >
72
84
73
- < JoinRoom />
74
- </ div >
85
+ < JoinRoom />
86
+ </ div >
75
87
76
- < Features />
77
- </ div >
88
+ < Features />
89
+ </ div >
78
90
79
- < div className = "flex w-full max-w-md items-center justify-center" >
80
- < Image
81
- src = { "assets/hero-image.svg" }
82
- alt = "Hero Image"
83
- width = { 500 }
84
- height = { 500 }
85
- priority
86
- />
87
- </ div >
88
- < div className = "absolute inset-x-0 top-[calc(100%-13rem)] -z-10 transform-gpu overflow-hidden opacity-60 blur-3xl sm:top-[calc(100%-30rem)]" >
89
- < svg
90
- className = "relative left-[calc(50%+3rem)] h-[21.1875rem] max-w-none -translate-x-1/2 sm:left-[calc(50%+36rem)] sm:h-[42.375rem]"
91
- viewBox = "0 0 1155 678"
92
- fill = "none"
93
- xmlns = "http://www.w3.org/2000/svg"
94
- >
95
- < path
96
- fill = "url(#ecb5b0c9-546c-4772-8c71-4d3f06d544bc)"
97
- fillOpacity = ".3"
98
- d = "M317.219 518.975L203.852 678 0 438.341l317.219 80.634 204.172-286.402c1.307 132.337 45.083 346.658 209.733 145.248C936.936 126.058 882.053-94.234 1031.02 41.331c119.18 108.451 130.68 295.337 121.53 375.223L855 299l21.173 362.054-558.954-142.079z"
99
- />
100
- < defs >
101
- < linearGradient
102
- id = "ecb5b0c9-546c-4772-8c71-4d3f06d544bc"
103
- x1 = "1155.49"
104
- x2 = "-78.208"
105
- y1 = ".177"
106
- y2 = "474.645"
107
- gradientUnits = "userSpaceOnUse"
108
- >
109
- < stop stopColor = "#9089FC" />
110
- < stop offset = { 1 } stopColor = "#FF80B5" />
111
- </ linearGradient >
112
- </ defs >
113
- </ svg >
91
+ < div className = "flex w-full max-w-md items-center justify-center" >
92
+ < Hero className = "h-[40vh] w-full md:h-screen" />
93
+ </ div >
94
+ < div className = "absolute inset-x-0 top-[calc(100%-13rem)] -z-10 transform-gpu overflow-hidden opacity-60 blur-3xl sm:top-[calc(100%-30rem)]" >
95
+ < svg
96
+ className = "relative left-[calc(50%+3rem)] h-[21.1875rem] max-w-none -translate-x-1/2 sm:left-[calc(50%+36rem)] sm:h-[42.375rem]"
97
+ viewBox = "0 0 1155 678"
98
+ fill = "none"
99
+ xmlns = "http://www.w3.org/2000/svg"
100
+ >
101
+ < path
102
+ fill = "url(#ecb5b0c9-546c-4772-8c71-4d3f06d544bc)"
103
+ fillOpacity = ".3"
104
+ d = "M317.219 518.975L203.852 678 0 438.341l317.219 80.634 204.172-286.402c1.307 132.337 45.083 346.658 209.733 145.248C936.936 126.058 882.053-94.234 1031.02 41.331c119.18 108.451 130.68 295.337 121.53 375.223L855 299l21.173 362.054-558.954-142.079z"
105
+ />
106
+ < defs >
107
+ < linearGradient
108
+ id = "ecb5b0c9-546c-4772-8c71-4d3f06d544bc"
109
+ x1 = "1155.49"
110
+ x2 = "-78.208"
111
+ y1 = ".177"
112
+ y2 = "474.645"
113
+ gradientUnits = "userSpaceOnUse"
114
+ >
115
+ < stop stopColor = "#9089FC" />
116
+ < stop offset = { 1 } stopColor = "#FF80B5" />
117
+ </ linearGradient >
118
+ </ defs >
119
+ </ svg >
120
+ </ div >
114
121
</ div >
115
- </ div >
122
+ </ main >
116
123
</ >
117
124
) ;
118
125
}
0 commit comments