3
3
from movie_streaming_site .state import State
4
4
from movie_streaming_site .components .search import search
5
5
from movie_streaming_site .components .footer import footer
6
-
6
+ from reflex_lottiefiles import LottieFiles
7
7
8
8
@rx .page (on_load = State .on_load )
9
9
def index ():
@@ -58,17 +58,9 @@ def index():
58
58
rx .grid (
59
59
rx .foreach (
60
60
State .now_playing ,
61
- lambda info , index : movie_card (info ["title" ], info ["year" ], f"{ info ['runtime' ]} mins" , info ["poster" ], description = info ["description" ])
61
+ lambda info , index : movie_card (info ["title" ], info ["year" ], f"{ info ['runtime' ]} mins" , info ["link" ], info [ " poster" ], description = info ["description" ])
62
62
63
63
),
64
- # movie_card("Borderlands", "2024", "1 hr 31 min", "https://cloud-6t0bvxvfn-hack-club-bot.vercel.app/7borders.jpg"),
65
- # movie_card("Dealpool & Wolverine", "2024", "1 hr 21 min", "https://cloud-6t0bvxvfn-hack-club-bot.vercel.app/3dead_and_wolv.jpg"),
66
- # movie_card("Despicable Me 4", "2024", "1 hr 35 min", "https://cloud-6t0bvxvfn-hack-club-bot.vercel.app/4minions_wer_despicible.jpg"),
67
- # movie_card("Joe Rogan", "2024", "1 hr 23 min", "https://cloud-6t0bvxvfn-hack-club-bot.vercel.app/6joe.jpg"),
68
- # movie_card("Trap", "2024", "2 hr 41 min", "https://cloud-6t0bvxvfn-hack-club-bot.vercel.app/5trap.jpg"),
69
- # movie_card("The Garfield Move", "2024", "101 min", "https://cloud-6t0bvxvfn-hack-club-bot.vercel.app/2garlf.jpg"),
70
- # movie_card("Inside Out 2", "2024", "1 hr 31 min", "https://cloud-6t0bvxvfn-hack-club-bot.vercel.app/1inside_out_2.jpg"),
71
- # movie_card("The Super Mario Bros Movie", "2023", "93 min", "https://cloud-6t0bvxvfn-hack-club-bot.vercel.app/0maro.jpg"),
72
64
footer (),
73
65
spacing = "1.5vh" ,
74
66
columns = "4" ,
@@ -87,76 +79,99 @@ def index():
87
79
88
80
89
81
90
- @rx .page (route = "/movieplayer/[movieid]" )
82
+ @rx .page (route = "/movieplayer/[movieid]" , on_load = State . on_load )
91
83
def movieplayer ():
92
84
return rx .box (
93
85
search (),
94
- rx .text (State .current_movie ["title" ], font_size = "10.5vh" , font_weight = "800" ),
95
- rx .hstack (
96
- rx .html (
97
- State .movie_iframe ,
98
- width = "50vw" ,
99
- height = "60vw"
100
- ),
101
- #rx.box(width="960px", height="540px", bg="#D9D9D9"),
102
- rx .vstack (
103
- rx .text (
104
- "Description" ,
105
- color = "white" ,
106
- font_size = "4vh" ,
107
- font_weight = "800"
108
- ),
109
- rx .text (
110
- State .current_movie ["description" ],
111
- color = "white" ,
112
- font_size = "3vh" ,
113
- max_width = "28vw"
86
+
87
+
88
+ rx .cond (
89
+ State .loading ,
90
+ rx .center (
91
+ rx .vstack (
92
+ rx .heading ("Loading, please wait" ),
93
+ LottieFiles (
94
+ src = "https://lottie.host/5ff06a80-3f45-4dd3-8737-f4cf62ba3d48/X5hdVEjbNK.lottie" ,
95
+ autoplay = True ,
96
+ loop = True ,
97
+ width = "20vw" ,
98
+ height = "20vw" ,
99
+ )
114
100
),
115
- align_items = "flex-start" ,
101
+
102
+ width = "100%" ,
103
+ height = "90vh"
116
104
),
117
- rx .desktop_only (
118
- rx .vstack (
119
- movie_info_item (State .current_movie ["date" ], "calendar" ),
120
- movie_info_item (State .current_movie ["revenue" ], "dollar-sign" ),
121
- movie_info_item (State .current_movie ["runtime" ], "clock" ),
122
-
123
- rx .cond (
124
- State .current_movie ["site" ],
125
- rx .link (
126
- movie_info_item ("Site" , "globe" ),
127
- href = State .current_movie ["site" ],
128
- is_external = True
105
+
106
+ rx .box (
107
+ rx .text (State .current_movie ["title" ], font_size = "10.5vh" , font_weight = "800" ),
108
+ rx .hstack (
109
+ rx .html (
110
+ State .movie_iframe ,
111
+ width = "50vw" ,
112
+ height = "60vw"
113
+ ),
114
+ #rx.box(width="960px", height="540px", bg="#D9D9D9"),
115
+ rx .vstack (
116
+ rx .text (
117
+ "Description" ,
118
+ color = "white" ,
119
+ font_size = "4vh" ,
120
+ font_weight = "800"
121
+ ),
122
+ rx .text (
123
+ State .current_movie ["description" ],
124
+ color = "white" ,
125
+ font_size = "3vh" ,
126
+ max_width = "28vw"
129
127
),
128
+ align_items = "flex-start" ,
130
129
),
131
- rx .cond (
132
- State .current_movie ["tmdb_link" ],
133
- rx .link (
134
- movie_info_item ("TMDB" , "clock" ),
135
- href = State .current_movie ["tmdb_link" ],
136
- is_external = True
130
+ rx .desktop_only (
131
+ rx .vstack (
132
+ movie_info_item (State .current_movie ["date" ], "calendar" ),
133
+ movie_info_item (State .current_movie ["revenue" ], "dollar-sign" ),
134
+ movie_info_item (State .current_movie ["runtime" ], "clock" ),
135
+
136
+ rx .cond (
137
+ State .current_movie ["site" ],
138
+ rx .link (
139
+ movie_info_item ("Site" , "globe" ),
140
+ href = State .current_movie ["site" ],
141
+ is_external = True
142
+ ),
143
+ ),
144
+ rx .cond (
145
+ State .current_movie ["tmdb_link" ],
146
+ rx .link (
147
+ movie_info_item ("TMDB" , "clock" ),
148
+ href = State .current_movie ["tmdb_link" ],
149
+ is_external = True
150
+ ),
151
+ ),
152
+ rx .cond (
153
+ State .current_movie ["imdb_link" ],
154
+ rx .link (
155
+ movie_info_item ("IMDB" , "clock" ),
156
+ href = State .current_movie ["imdb_link" ],
157
+ is_external = True
158
+ )
159
+ )
160
+
161
+
162
+
137
163
),
138
164
),
139
- rx .cond (
140
- State .current_movie ["imdb_link" ],
141
- rx .link (
142
- movie_info_item ("IMDB" , "clock" ),
143
- href = State .current_movie ["imdb_link" ],
144
- is_external = True
145
- )
146
- )
147
-
148
-
149
165
166
+ spacing = "2vw" ,
150
167
),
151
- ),
152
-
153
- spacing = "2vw" ,
168
+ )
154
169
),
170
+
155
171
156
172
157
173
width = "100%" ,
158
174
padding = "5.5vh" ,
159
- on_mount = State .on_load
160
175
)
161
176
162
177
def movie_info_item (text , icon ):
0 commit comments