Skip to content

Commit

Permalink
change to YTGo
Browse files Browse the repository at this point in the history
  • Loading branch information
nxrmqlly committed Nov 21, 2024
1 parent 502d34c commit 34f1185
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 16 deletions.
5 changes: 3 additions & 2 deletions backend/controllers/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"strings"
"unicode"

"youtube-downloader-go/backend/models"
"youtube-downloader-go/backend/utils"
"YTGo/backend/models"
"YTGo/backend/utils"

"github.com/wailsapp/wails/v2/pkg/runtime"
)
Expand Down Expand Up @@ -86,4 +86,5 @@ func (a *App) DownloadVideo(videoInfo models.VideoInfo, opts models.DownloadOpti
}

return "Done downloading", nil

}
4 changes: 2 additions & 2 deletions backend/controllers/get.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"net/url"
"os/exec"

"youtube-downloader-go/backend/models"
"youtube-downloader-go/backend/utils"
"YTGo/backend/models"
"YTGo/backend/utils"
)

func (a *App) GetVideoInfo(videoURL string) (models.VideoInfo, error) {
Expand Down
30 changes: 19 additions & 11 deletions frontend/src/components/VideoModal.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import { onAccesibilityKeydown } from "../utils/accessibility.js";
import { DownloadVideo } from "../../wailsjs/go/controllers/App.js";
import "@fortawesome/fontawesome-free/css/all.min.css";
import { preventDefault } from "svelte/legacy";
/** @type {{onClose: any, videoInfo: any}} */
let { onClose, videoInfo } = $props();
Expand Down Expand Up @@ -47,8 +48,7 @@ const audioOptions = audioExtOptions.map((ext) => ({
}));
// Switch between video and audio tab and reset the selected option
function switchTab(event, tab) {
event.preventDefault();
function switchTab(tab) {
currentTab = tab;
selectedOption = ""; // Reset the selected option when tab changes
}
Expand Down Expand Up @@ -160,39 +160,47 @@ function switchTab(event, tab) {
}
.tab {
background-color: var(--duo-bg-color);
color: var(--fg-color);
cursor: pointer;
padding: 0.5rem 1rem;
border-bottom: 2px solid transparent;
border: 0;
padding-bottom: 1em;
overflow: hidden;
}
.tab.active {
border-bottom: 2px solid transparent;
border-color: var(--accent);
font-weight: bold;
}
</style>

<div
class="modal"
role="button"
tabindex="0"
onclick={onClose}

onkeydown={onAccesibilityKeydown}
>
<div class="modal-content">
<h2>{videoInfo.title}</h2>
<div class="video-desc">
<p><i class="fa-regular fa-user"></i> {videoInfo.uploader}</p>
<p><i class="fa-regular fa-clock"></i> {formatDuration(videoInfo.duration)}</p>
<p><i class="fa-regular fa-eye"></i> {videoInfo.view_count.toLocaleString()}</p>
<p><i class="fa-regular fa-user"></i> {videoInfo.uploader || "N/A"}</p>
<p><i class="fa-regular fa-clock"></i> {formatDuration(videoInfo.duration) || "N/A"}</p>
<p><i class="fa-regular fa-eye"></i> {videoInfo.view_count.toLocaleString() || "N/A"}</p>
</div>
<img class="thumbnail" src={videoInfo.thumbnail} alt="Video thumbnail" />
{#if videoInfo.thumbnail}
<img class="thumbnail" src={videoInfo.thumbnail} alt="Video thumbnail" />
{:else}
<p>No thumbnail available</p>
{/if}

<!-- Tab Bar -->
<div class="tab-bar">
<button class="tab {currentTab === 'video' ? 'active' : ''}" onkeydown={onAccesibilityKeydown} onclick={(e) => switchTab(e, 'video')}>
<button class="tab {currentTab === 'video' ? 'active' : ''}" onclick={(e) => {e.preventDefault(); switchTab('video')}}>
Video
</button>
<button class="tab {currentTab === 'audio' ? 'active' : ''}" onkeydown={onAccesibilityKeydown} onclick={(e) => switchTab(e, 'audio')}>
<button class="tab {currentTab === 'audio' ? 'active' : ''}" onclick={(e) => {e.preventDefault(); switchTab('audio')}}>
Audio
</button>
</div>
Expand Down
19 changes: 19 additions & 0 deletions frontend/tailwind.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ['./src/**/*.{html,js,svelte}'],
theme: {
extend: {
colors: {
accent: '#99667a',
'duo-accent': '#744457',
'confirm-color': '#5aa071',
'duo-confirm-color': '#518060',
'deny-color': '#b33a3a',
'duo-deny-color': '#8a3434',
},
fontFamily: {
satoshi: ['Satoshi', 'sans-serif'],
},
},
},
};
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module youtube-downloader-go
module YTGo

go 1.21

Expand Down

0 comments on commit 34f1185

Please sign in to comment.