Skip to content

Commit

Permalink
fix bug for user profile and fix light mode issue on btn icons
Browse files Browse the repository at this point in the history
  • Loading branch information
KJHJason committed May 21, 2024
1 parent fd0aa13 commit 5b54b58
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 13 deletions.
5 changes: 3 additions & 2 deletions backend/app/user.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package app

import (
"encoding/base64"
"fmt"
"os"
"path/filepath"
Expand All @@ -22,7 +23,7 @@ type ProfilePic struct {
Path string `json:"Path"`
Type string `json:"Type"`
Filename string `json:"Filename"`
Data []byte `json:"Data"`
Data string `json:"Data"`
}

func NewProfilePic(path string) (ProfilePic, error) {
Expand All @@ -49,7 +50,7 @@ func NewProfilePic(path string) (ProfilePic, error) {
}

pic.Path = path
pic.Data = data
pic.Data = base64.StdEncoding.EncodeToString(data)
pic.Filename = filepath.Base(path)
return pic, nil
}
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/lib/PlatformBase.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -295,8 +295,8 @@
<div class="mt-2 text-right">
<Helper id="url-helper" color="red" />
<button type="submit" class="mt-2 btn btn-success" id="add-to-queue-btn">
<div class="flex">
<ArrowLeftOutline />
<div class="flex text-main">
<ArrowLeftOutline class="" />
<Translate text="Add to queue!" />
</div>
</button>
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/lib/settings/General.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@
profileImageInput.addEventListener("click", async (e: Event) => {
e.preventDefault();
const profilePicInfo = await SelectProfilePic();
const profilePicPath = profilePicInfo.Path as string;
const profilePicFilename = profilePicInfo.Filename as string;
const profilePicType = profilePicInfo.Type as string;
const profilePicData = profilePicInfo.Data as string; // base64 encoded string
const profilePicPath = profilePicInfo.Path;
const profilePicFilename = profilePicInfo.Filename;
const profilePicType = profilePicInfo.Type;
const profilePicData = profilePicInfo.Data; // base64 encoded string
if (!profilePicPath) {
return;
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/lib/settings/GeneralSettings.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,9 @@
<CacheDetails bind:open={cacheDetailsOpened} />
<div class="mt-5">
<button type="button" class="btn btn-info flex" on:click={() => cacheDetailsOpened = true} >
<ArchiveSolid />
<div class="text-main">
<ArchiveSolid />
</div>
<Translate text="View Cache" />
</button>
</div>
Expand Down
8 changes: 5 additions & 3 deletions frontend/src/lib/settings/ProgramInfo.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -105,9 +105,11 @@
<Translate text="via GitHub sponsors! Your contribution would help ensure the sustainability of this project. Thank you for reading <3" />
</Helper>
<button class="mt-2 ms-auto flex btn btn-success items-center" id="update-btn">
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" class="shrink-0 w-4 h-4 me-2" role="img" aria-label="update solid" viewBox="0 0 122.61 122.88">
<path d="M111.9,61.57a5.36,5.36,0,0,1,10.71,0A61.3,61.3,0,0,1,17.54,104.48v12.35a5.36,5.36,0,0,1-10.72,0V89.31A5.36,5.36,0,0,1,12.18,84H40a5.36,5.36,0,1,1,0,10.71H23a50.6,50.6,0,0,0,88.87-33.1ZM106.6,5.36a5.36,5.36,0,1,1,10.71,0V33.14A5.36,5.36,0,0,1,112,38.49H84.44a5.36,5.36,0,1,1,0-10.71H99A50.6,50.6,0,0,0,10.71,61.57,5.36,5.36,0,1,1,0,61.57,61.31,61.31,0,0,1,91.07,8,61.83,61.83,0,0,1,106.6,20.27V5.36Z"/>
</svg>
<div class="text-main">
<svg xmlns="http://www.w3.org/2000/svg" fill="currentColor" class="shrink-0 w-4 h-4 me-2" role="img" aria-label="update solid" viewBox="0 0 122.61 122.88">
<path d="M111.9,61.57a5.36,5.36,0,0,1,10.71,0A61.3,61.3,0,0,1,17.54,104.48v12.35a5.36,5.36,0,0,1-10.72,0V89.31A5.36,5.36,0,0,1,12.18,84H40a5.36,5.36,0,1,1,0,10.71H23a50.6,50.6,0,0,0,88.87-33.1ZM106.6,5.36a5.36,5.36,0,1,1,10.71,0V33.14A5.36,5.36,0,0,1,112,38.49H84.44a5.36,5.36,0,1,1,0-10.71H99A50.6,50.6,0,0,0,10.71,61.57,5.36,5.36,0,1,1,0,61.57,61.31,61.31,0,0,1,91.07,8,61.83,61.83,0,0,1,106.6,20.27V5.36Z"/>
</svg>
</div>
<Translate text="check for updates" />
</button>
</div>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/scripts/wailsjs/go/models.ts
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ export namespace app {
Path: string;
Type: string;
Filename: string;
Data: number[];
Data: string;

static createFrom(source: any = {}) {
return new ProfilePic(source);
Expand Down

0 comments on commit 5b54b58

Please sign in to comment.