Skip to content

Commit

Permalink
增加了专辑图居左设置
Browse files Browse the repository at this point in the history
修正了歌名、别名、歌手、专辑不能居左的问题
修正了版本更新的比较方式
  • Loading branch information
Steve-xmh committed Feb 8, 2023
1 parent 5d9f32b commit 3009e06
Show file tree
Hide file tree
Showing 10 changed files with 51 additions and 43 deletions.
2 changes: 1 addition & 1 deletion dist/index.css

Large diffs are not rendered by default.

58 changes: 29 additions & 29 deletions dist/index.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
],
"description": "一个基于 BetterNCM 的类 Apple Music 歌词显示插件",
"preview": "preview.svg",
"version": "1.8.1",
"version": "1.8.2",
"type": "extension",
"noDevReload": true,
"requirements": [
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
],
"description": "一个基于 BetterNCM 的类 Apple Music 歌词显示插件",
"preview": "preview.svg",
"version": "1.8.1",
"version": "1.8.2",
"type": "extension",
"noDevReload": true,
"requirements": [
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "applemusic-like-lyrics",
"version": "1.8.1",
"version": "1.8.2",
"main": "index.js",
"private": true,
"license": "GPL-3.0",
Expand Down Expand Up @@ -32,6 +32,7 @@
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-simple-code-editor": "^0.13.1",
"semver": "^7.3.8",
"semver-compare": "^1.0.0",
"typescript": "^4.9.4"
},
Expand Down
3 changes: 2 additions & 1 deletion src/api/react.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
lyricErrorAtom,
musicIdAtom,
} from "../core/states";
import semverGt from "semver/functions/gt";

export function useConfig(
key: string,
Expand Down Expand Up @@ -217,7 +218,7 @@ export function useGithubLatestVersion(): string {
export function useHasUpdates(): boolean {
const githubVersion = useGithubLatestVersion();
return React.useMemo(
() => githubVersion !== "" && githubVersion !== version,
() => githubVersion !== "" && semverGt(githubVersion, version),
[githubVersion],
);
}
Expand Down
7 changes: 3 additions & 4 deletions src/config/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ import { SongInfoStyleSettings } from "./song-info-style";
import { OtherStyleSettings } from "./other-style";
import { LyricSourceSettings } from "./lyric-source";
import { CustomCSSSettings } from "./custom-css";
import { version } from "../../manifest.json";
import { useGithubLatestVersion } from "../api/react";
import { useHasUpdates } from "../api/react";
import { Provider } from "jotai";
import { BackgroundSettings } from "./background";

Expand All @@ -26,7 +25,7 @@ const PanelWrapper: React.FC<React.PropsWithChildren> = (props) => {

const ConfigComponent: React.FC = () => {
const hasWarnings = useHasWarnings();
const latestVersion = useGithubLatestVersion();
const hasUpdates = useHasUpdates();

return (
<Tabs
Expand All @@ -51,7 +50,7 @@ const ConfigComponent: React.FC = () => {
<Tabs.Tab value="lyric-source">EAPI 函数设置</Tabs.Tab>
<Tabs.Tab value="custom-css">自定义 CSS 设置</Tabs.Tab>
<Tabs.Tab value="about">
{latestVersion !== "" && latestVersion !== version ? (
{hasUpdates ? (
<Indicator offset={-3} size={6} color="yellow">
关于
</Indicator>
Expand Down
4 changes: 4 additions & 0 deletions src/config/song-info-style.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ export const SongInfoStyleSettings: React.FC = () => {
<SwitchConfigComponent settingKey="hideMusicAlias" label="隐藏歌曲别名" />
<SwitchConfigComponent settingKey="hideMusicArtists" label="隐藏歌手名" />
<SwitchConfigComponent settingKey="hideMusicAlbum" label="隐藏专辑名" />
<SwitchConfigComponent
settingKey="alignLeftAlbumImage"
label="专辑图居左"
/>
<SwitchConfigComponent settingKey="alignLeftMusicName" label="歌名居左" />
<SwitchConfigComponent
settingKey="alignLeftMusicAlias"
Expand Down
1 change: 0 additions & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -515,7 +515,6 @@ export const useStyles = createStyles;
export const ThemeProvider: React.FC<React.PropsWithChildren> = (props) => {
return (
<MantineProvider
withNormalizeCSS
theme={{
colorScheme: "dark",
}}
Expand Down
12 changes: 8 additions & 4 deletions src/main-view.sass
Original file line number Diff line number Diff line change
Expand Up @@ -251,21 +251,25 @@ $tween-animation-timing: cubic-bezier(0.65, 0, 0.35, 1)
&.use-ping-fang-font *
font-family: 'San Francisco', 'Helvetica', 'PingFang SC' !important

// 专辑图居左
&.align-left-album-image .am-album-image
align-self: flex-start !important

// 歌名居左
&.align-left-music-name .am-music-name
text-align: left
text-align: left !important

// 歌曲别名居左
&.align-left-music-alias .am-music-alias
text-align: left
text-align: left !important

// 歌手名居左
&.align-left-music-artists .am-music-artists
justify-content: left
justify-content: left !important

// 专辑名居左
&.align-left-music-album .am-music-album
justify-content: left
justify-content: left !important

// 隐藏歌手名标签
&.hide-music-artists-label .am-artists-label
Expand Down

0 comments on commit 3009e06

Please sign in to comment.