Skip to content

Commit

Permalink
Merge pull request #290 from caorushizi/dev-icon
Browse files Browse the repository at this point in the history
feat: ✨  optimized app ICONS
  • Loading branch information
caorushizi authored Sep 26, 2024
2 parents 96de18a + 03ab5ef commit e7e5280
Show file tree
Hide file tree
Showing 17 changed files with 32 additions and 12 deletions.
Binary file added packages/main/assets/icon-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified packages/main/assets/icon.icns
Binary file not shown.
Binary file modified packages/main/assets/icon.ico
Binary file not shown.
Binary file modified packages/main/assets/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed packages/main/assets/icon_dark.png
Binary file not shown.
Binary file removed packages/main/assets/icon_light.png
Binary file not shown.
Binary file removed packages/main/assets/icon_new.png
Binary file not shown.
4 changes: 3 additions & 1 deletion packages/main/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { DownloadStatus } from "./interfaces.ts";
import { TYPES } from "./types.ts";
import { Menu, Tray, app, nativeImage, nativeTheme } from "electron";
import TrayIcon from "./tray-icon.png";
import TrayIconLight from "./tray-icon-light.png";
import path from "path";
import MainWindow from "./windows/MainWindow.ts";
import WebviewService from "./services/WebviewService.ts";
Expand All @@ -15,6 +16,7 @@ import ProtocolService from "./core/protocol.ts";
import IpcHandlerService from "./core/ipc.ts";
import { VideoService } from "./services/VideoService.ts";
import i18n from "./i18n/index.ts";
import { isMac } from "./helper/variables.ts";

@injectable()
export default class ElectronApp {
Expand Down Expand Up @@ -83,7 +85,7 @@ export default class ElectronApp {
}

initTray() {
const iconPath = path.resolve(__dirname, TrayIcon);
const iconPath = path.resolve(__dirname, isMac ? TrayIconLight : TrayIcon);
const icon = nativeImage.createFromPath(iconPath);
const tray = new Tray(icon);
tray.setToolTip("Media Go");
Expand Down
Binary file added packages/main/src/tray-icon-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified packages/main/src/tray-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions packages/mobile/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<link rel="icon" type="image/svg+xml" href="/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + React + TS</title>
<title>MediaGo Mobile</title>
</head>
<body>
<div id="root"></div>
Expand Down
Binary file added packages/mobile/public/favicon.ico
Binary file not shown.
1 change: 0 additions & 1 deletion packages/mobile/public/vite.svg

This file was deleted.

22 changes: 16 additions & 6 deletions packages/mobile/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,34 @@
import { useMount } from "ahooks";
import { List, NavBar } from "antd-mobile";
import axios from "axios";
import { useRef, useState } from "react";
import Player from "xgplayer";
import "xgplayer/dist/index.min.css";
import { cn } from "./utils";
import { cn, http } from "./utils";

interface VideoSource {
title: string;
url: string;
}

function App() {
const [data, setData] = useState<any[]>([]);
const [data, setData] = useState<VideoSource[]>([]);
const player = useRef<Player>();
const [currentVideo, setCurrentVideo] = useState("");

useMount(async () => {
const { data } = await axios.get<any[]>("/api");
const { data } = await http.get<VideoSource[]>("/api");
console.log(data);
setData(data);
setCurrentVideo(data[0].url);

let url = "";
if (data.length > 0) {
url = data[0].url;
setCurrentVideo(url);
}

player.current = new Player({
id: "mse",
url: data[0].url,
url: url,
fluid: true,
lang: "zh-cn",
});
Expand Down
7 changes: 7 additions & 0 deletions packages/mobile/src/utils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import { twMerge } from "tailwind-merge";
import { type ClassValue, clsx } from "clsx";
import axios from "axios";

export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs));
}

console.log(import.meta.env.MODE);
export const http = axios.create({
baseURL:
import.meta.env.MODE === "development" ? "http://localhost:3222" : "/",
});
1 change: 0 additions & 1 deletion packages/renderer/src/assets/svg/FavIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ export function FavIcon(props: React.SVGProps<SVGSVGElement>) {
d="M18.6508 8.79885L14.1178 12.2394L15.864 17.8376C15.8912 17.9243 15.9063 18.018 15.9063 18.1141C15.9063 18.604 15.5284 19 15.0625 19C14.8776 19 14.7073 18.9368 14.5681 18.8313L10 15.3648L5.43196 18.8312C5.29304 18.9368 5.12234 19 4.93749 19C4.47138 19 4.09373 18.6039 4.09373 18.114C4.09373 18.0179 4.10876 17.9242 4.13598 17.8375L5.88218 12.2394L1.34903 8.79885C1.13752 8.63829 1 8.37697 1 8.08164C1 7.59297 1.37765 7.19686 1.84373 7.19686H7.45543L9.19312 1.62576C9.29915 1.26252 9.6201 1 10 1C10.3799 1 10.7009 1.2625 10.8066 1.62576L12.5446 7.19686H18.1563C18.6224 7.19686 19 7.59297 19 8.08164C19 8.37697 18.8622 8.63829 18.6508 8.79885Z"
fill="none"
strokeWidth="1.8"
stroke="#000"
/>
</svg>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,10 @@ export function ToolBar({ page }: Props) {
curIsFavorite ? (
<FavFillIcon fill={iconColor} />
) : (
<FavIcon fill={iconColor} />
<FavIcon
fill={iconColor}
stroke={theme === "dark" ? "#B4B4B4" : "#020817"}
/>
)
}
/>
Expand Down

0 comments on commit e7e5280

Please sign in to comment.