feat(nvim): implement basic layout

This commit is contained in:
Pihkaal
2024-05-30 15:44:49 +02:00
parent e21d337d53
commit 3832a7ca52
9 changed files with 66 additions and 13 deletions

View File

@@ -18,8 +18,12 @@ export const SpotifyPlayer = (props: {
<div
className="grid select-none"
style={{
gridTemplateColumns: `${CHAR_WIDTH}px ${CHAR_WIDTH * 8}px 1fr ${CHAR_WIDTH}px`,
gridTemplateRows: `${CHAR_HEIGHT}px ${CHAR_HEIGHT * 3}px ${CHAR_HEIGHT}px`,
gridTemplateColumns: `${CHAR_WIDTH}px ${
CHAR_WIDTH * 8
}px 1fr ${CHAR_WIDTH}px`,
gridTemplateRows: `${CHAR_HEIGHT}px ${
CHAR_HEIGHT * 3
}px ${CHAR_HEIGHT}px`,
}}
>
{kitty && <InnerSpotifyPlayer {...props} {...kitty} />}
@@ -35,7 +39,9 @@ const InnerSpotifyPlayer = (props: InnerKittyProps<typeof SpotifyPlayer>) => {
);
const emptySize = props.cols - 2 - fillSize;
const timeString = `${formatMMSS(props.played)}/${formatMMSS(props.duration)}`;
const timeString = `${formatMMSS(props.played)}/${formatMMSS(
props.duration,
)}`;
const timeStringLeft = Math.round(
(props.cols - 2) / 2 - timeString.length / 2,
);

View File

@@ -30,9 +30,9 @@ export const Music = () => {
if (metadata) return;
void fetch(song)
.then((r) => r.blob())
.then((b) => parseBlob(b))
.then((m) => {
.then(r => r.blob())
.then(b => parseBlob(b))
.then(m => {
if (!audio.current) return;
setMetadata(m);