Skip to content

Commit 9d37bd6

Browse files
committed
Various Base UI improvements
1 parent f52ce82 commit 9d37bd6

10 files changed

Lines changed: 41 additions & 27 deletions

File tree

src/components/Header.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { Popover } from '@base-ui/react/popover';
22
import { useLingui } from '@lingui/react/macro';
33
import * as stylex from '@stylexjs/stylex';
4+
import { useRef } from 'react';
45

56
import ButtonIcon from '../elements/ButtonIcon';
67
import { usePlayerState } from '../hooks/usePlayer';
@@ -16,6 +17,7 @@ export default function Header() {
1617
const trackPlaying = usePlayingTrack();
1718
const { t } = useLingui();
1819
const platform = window.__MUSEEKS_PLATFORM;
20+
const queueAnchorRef = useRef<HTMLDivElement>(null);
1921

2022
return (
2123
<header
@@ -41,7 +43,7 @@ export default function Header() {
4143
<>
4244
<PlayingBar trackPlaying={trackPlaying} />
4345
<Popover.Root>
44-
<div {...stylex.props(styles.queue)}>
46+
<div ref={queueAnchorRef} {...stylex.props(styles.queue)}>
4547
<Popover.Trigger
4648
render={(triggerProps) => (
4749
<ButtonIcon
@@ -55,7 +57,12 @@ export default function Header() {
5557
/>
5658
</div>
5759
<Popover.Portal>
58-
<Popover.Positioner side="bottom" align="end">
60+
<Popover.Positioner
61+
side="bottom"
62+
alignOffset={-16}
63+
align="end"
64+
anchor={queueAnchorRef}
65+
>
5966
<Popover.Popup {...stylex.props(styles.queueContainer)}>
6067
<Queue queue={queue} queueCursor={queueCursor} />
6168
</Popover.Popup>

src/components/Navigation.tsx

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -106,14 +106,12 @@ function Status() {
106106
{isScanning ? (
107107
t`scanning tracks...`
108108
) : (
109-
<ProgressBar progress={progress} />
109+
<ProgressBar
110+
progress={progress}
111+
label={total > 0 ? `${current} / ${total}` : ''}
112+
/>
110113
)}
111114
</div>
112-
{total > 0 && (
113-
<div {...stylex.props(styles.statusLibraryRefreshCount)}>
114-
{current} / {total}
115-
</div>
116-
)}
117115
</div>
118116
);
119117
}
@@ -199,9 +197,5 @@ const styles = stylex.create({
199197
},
200198
statusLibraryRefreshProgress: {
201199
flex: '1',
202-
marginRight: '10px',
203-
},
204-
statusLibraryRefreshCount: {
205-
fontVariantNumeric: 'tabular-nums',
206200
},
207201
});

src/components/ProgressBar.tsx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import * as stylex from '@stylexjs/stylex';
33

44
type Props = {
55
progress?: number;
6+
label: string;
67
};
78

89
export default function ProgressBar(props: Props) {
@@ -17,16 +18,22 @@ export default function ProgressBar(props: Props) {
1718
style={{ width: `${props.progress ?? 0}%` }}
1819
/>
1920
</Progress.Track>
21+
<Progress.Label {...stylex.props(styles.progressLabel)}>
22+
{props.label}
23+
</Progress.Label>
2024
</Progress.Root>
2125
);
2226
}
2327

2428
const styles = stylex.create({
2529
progress: {
2630
flex: '1',
27-
display: 'block',
31+
display: 'flex',
32+
gap: '12px',
33+
alignItems: 'center',
2834
},
2935
progressTrack: {
36+
flexGrow: 1,
3037
height: '6px',
3138
backgroundColor: 'var(--progress-bg)',
3239
},
@@ -35,4 +42,10 @@ const styles = stylex.create({
3542
backgroundColor: 'var(--main-color)',
3643
transition: 'width 0.2s ease-in-out',
3744
},
45+
progressLabel: {
46+
flexShrink: 0,
47+
fontSize: '12px',
48+
color: 'var(--text-color)',
49+
fontVariantNumeric: 'tabular-nums',
50+
},
3851
});

src/translations/en.po

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@ msgstr "Try <0>reloading the app</0>,"
6363
msgid "or if it happens again, please <0>report an issue</0>."
6464
msgstr "or if it happens again, please <0>report an issue</0>."
6565

66-
#: src/components/Header.tsx:22
66+
#: src/components/Header.tsx:24
6767
msgid "Header"
6868
msgstr "Header"
6969

70-
#: src/components/Header.tsx:51
70+
#: src/components/Header.tsx:53
7171
msgid "Queue"
7272
msgstr "Queue"
7373

src/translations/es.po

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@ msgstr "Intenta <0>recargar la aplicación</0>,"
6363
msgid "or if it happens again, please <0>report an issue</0>."
6464
msgstr "o si vuelve a ocurrir, por favor <0>reporta un problema</0>."
6565

66-
#: src/components/Header.tsx:22
66+
#: src/components/Header.tsx:24
6767
msgid "Header"
6868
msgstr ""
6969

70-
#: src/components/Header.tsx:51
70+
#: src/components/Header.tsx:53
7171
msgid "Queue"
7272
msgstr "Cola"
7373

src/translations/fr.po

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@ msgstr "Essayez de <0>recharger l'application</0>,"
6363
msgid "or if it happens again, please <0>report an issue</0>."
6464
msgstr "ou si cela se reproduit, veuillez <0>signaler un problème</0>."
6565

66-
#: src/components/Header.tsx:22
66+
#: src/components/Header.tsx:24
6767
msgid "Header"
6868
msgstr ""
6969

70-
#: src/components/Header.tsx:51
70+
#: src/components/Header.tsx:53
7171
msgid "Queue"
7272
msgstr "File d'attente"
7373

src/translations/ja.po

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@ msgstr "<0>アプリを再読み込み</0>してみてください、"
6363
msgid "or if it happens again, please <0>report an issue</0>."
6464
msgstr "また同じことが起こった場合は、<0>問題を報告してください</0>。"
6565

66-
#: src/components/Header.tsx:22
66+
#: src/components/Header.tsx:24
6767
msgid "Header"
6868
msgstr ""
6969

70-
#: src/components/Header.tsx:51
70+
#: src/components/Header.tsx:53
7171
msgid "Queue"
7272
msgstr "キュー"
7373

src/translations/ru.po

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@ msgstr "Попробуйте <0>перезагрузить приложение<
6363
msgid "or if it happens again, please <0>report an issue</0>."
6464
msgstr "Если это случится снова, пожалуйста, <0>заявите об ошибке</0>."
6565

66-
#: src/components/Header.tsx:22
66+
#: src/components/Header.tsx:24
6767
msgid "Header"
6868
msgstr ""
6969

70-
#: src/components/Header.tsx:51
70+
#: src/components/Header.tsx:53
7171
msgid "Queue"
7272
msgstr "Очередь"
7373

src/translations/zh-CN.po

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@ msgstr "尝试 <0>重新加载应用程序</0>,"
6363
msgid "or if it happens again, please <0>report an issue</0>."
6464
msgstr "如果再次发生,请<0>报告问题</0>。"
6565

66-
#: src/components/Header.tsx:22
66+
#: src/components/Header.tsx:24
6767
msgid "Header"
6868
msgstr ""
6969

70-
#: src/components/Header.tsx:51
70+
#: src/components/Header.tsx:53
7171
msgid "Queue"
7272
msgstr "播放队列"
7373

src/translations/zh-TW.po

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,11 @@ msgstr "嘗試 <0>重新載入應用程式</0>,"
6363
msgid "or if it happens again, please <0>report an issue</0>."
6464
msgstr "如果再次發生,請<0>回報問題</0>。"
6565

66-
#: src/components/Header.tsx:22
66+
#: src/components/Header.tsx:24
6767
msgid "Header"
6868
msgstr ""
6969

70-
#: src/components/Header.tsx:51
70+
#: src/components/Header.tsx:53
7171
msgid "Queue"
7272
msgstr "播放佇列"
7373

0 commit comments

Comments
 (0)