From 4df9078428bdc30c549c915cc72ccc20ade8ad85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20Lachapelle?= Date: Fri, 25 Oct 2024 00:58:28 -0700 Subject: [PATCH] start with only custom sources --- src-tauri/src/lib.rs | 11 +++++- src/app/setup/setup.component.css | 10 +++++ src/app/setup/setup.component.html | 63 ++++++++++++++++++++---------- src/app/setup/setup.component.ts | 16 ++++++++ 4 files changed, 78 insertions(+), 22 deletions(-) diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index c36ade8..f23595c 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -41,7 +41,8 @@ pub fn run() { add_custom_channel, get_channel_headers, edit_custom_channel, - delete_custom_channel + delete_custom_channel, + add_custom_source ]) .run(tauri::generate_context!()) .expect("error while running tauri application"); @@ -165,4 +166,10 @@ fn delete_custom_channel(id: i64) -> Result<(), String> { #[tauri::command(async)] fn get_channel_headers(id: i64) -> Result, String> { sql::get_channel_headers_by_id(id).map_err(map_err_frontend) -} \ No newline at end of file +} + +#[tauri::command(async)] +fn add_custom_source() -> Result<(), String> { + sql::create_or_find_source_by_name(&mut sql::get_custom_source()).map_err(map_err_frontend)?; + Ok(()) +} diff --git a/src/app/setup/setup.component.css b/src/app/setup/setup.component.css index e21b44e..fe6e805 100644 --- a/src/app/setup/setup.component.css +++ b/src/app/setup/setup.component.css @@ -21,3 +21,13 @@ button .anim-svg { button:hover .anim-svg { transform: scale(125%); } + +button .pen { + width: 1.5rem; + height: 1.5rem; + transition: transform 0.3s ease; +} + +button:hover .pen { + transform: scale(125%); +} \ No newline at end of file diff --git a/src/app/setup/setup.component.html b/src/app/setup/setup.component.html index 6eef638..4c5ddcd 100644 --- a/src/app/setup/setup.component.html +++ b/src/app/setup/setup.component.html @@ -1,4 +1,7 @@ - + + +

Let's add your first source

@@ -12,38 +15,42 @@

Let's add another source

triggers="hover" [ngClass]="{'active': source.source_type == sourceTypeEnum.M3ULink}">M3U URL +
-
-
- + +
+
+ +
-
-
-
- This source name is already taken +
+
+ This source name is already taken +
-
- -
+ +
- +
- +
- +
@@ -51,15 +58,31 @@

Let's add another source

diff --git a/src/app/setup/setup.component.ts b/src/app/setup/setup.component.ts index 6c51161..9ae048c 100644 --- a/src/app/setup/setup.component.ts +++ b/src/app/setup/setup.component.ts @@ -75,7 +75,23 @@ export class SetupComponent { break; case SourceType.Xtream: await this.getXtream(); + break; + case SourceType.Custom: + await this.startWithCustomOnly(); + break; + } + } + + async startWithCustomOnly() { + this.loading = true; + try { + await invoke('add_custom_source'); + this.nav.navigateByUrl(""); } + catch(e) { + this.error.handleError(e, "Invalid URL or credentials. Please try again"); + } + this.loading = false; } async getM3ULink() {