()
| 149 | self.reset() |
| 150 | |
| 151 | def index(): |
| 152 | return rx.vstack( |
| 153 | rx.input( |
| 154 | value=UploadState.router.session.client_token, |
| 155 | read_only=True, |
| 156 | id="token", |
| 157 | ), |
| 158 | rx.input( |
| 159 | value=UploadState.upload_done.to_string(), |
| 160 | read_only=True, |
| 161 | id="upload_done", |
| 162 | ), |
| 163 | rx.button( |
| 164 | "Clear Uploaded Files", |
| 165 | id="clear_uploads", |
| 166 | on_click=UploadState.clear_uploads, |
| 167 | ), |
| 168 | rx.heading("Default Upload"), |
| 169 | rx.upload.root( |
| 170 | rx.vstack( |
| 171 | rx.button("Select File"), |
| 172 | rx.text("Drag and drop files here or click to select files"), |
| 173 | ), |
| 174 | disabled=UploadState.disabled, |
| 175 | ), |
| 176 | rx.button( |
| 177 | "Upload", |
| 178 | on_click=lambda: UploadState.handle_upload(rx.upload_files()), # pyright: ignore [reportArgumentType] |
| 179 | id="upload_button", |
| 180 | ), |
| 181 | rx.box( |
| 182 | rx.foreach( |
| 183 | rx.selected_files(), |
| 184 | lambda f: rx.text(f, as_="p"), |
| 185 | ), |
| 186 | id="selected_files", |
| 187 | ), |
| 188 | rx.button( |
| 189 | "Clear", |
| 190 | on_click=rx.clear_selected_files, |
| 191 | id="clear_button", |
| 192 | ), |
| 193 | rx.heading("Secondary Upload"), |
| 194 | rx.upload.root( |
| 195 | rx.vstack( |
| 196 | rx.button("Select File"), |
| 197 | rx.text("Drag and drop files here or click to select files"), |
| 198 | ), |
| 199 | id="secondary", |
| 200 | ), |
| 201 | rx.button( |
| 202 | "Upload", |
| 203 | on_click=UploadState.handle_upload_secondary( |
| 204 | rx.upload_files( # pyright: ignore [reportArgumentType] |
| 205 | upload_id="secondary", |
| 206 | on_upload_progress=UploadState.upload_progress, |
| 207 | ), |
| 208 | ), |
nothing calls this directly
no test coverage detected