Merge pull request #143 from ragestudio/dev

This commit is contained in:
srgooglo 2025-05-15 15:09:39 +02:00 committed by GitHub
commit 16633e30c0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 0 additions and 212 deletions

View File

@ -1,94 +0,0 @@
import React from "react"
import { Button, Modal } from "antd"
import { Icons, createIconRender } from "@components/Icons"
import SyncModel from "@models/sync"
import "./index.less"
export default (props) => {
const { namespace } = props
const onUnlink = async () => {
Modal.confirm({
title: "Are you sure you want to unlink?",
content: "The linked service will be unlinked from your account and you loose access to their features",
okText: "Logout",
okType: "danger",
cancelText: "Cancel",
onOk: async () => {
await SyncModel.unlinkService(namespace)
.then(() => {
app.message.success("Successfully unlinked account")
})
.catch((err) => {
console.error(err)
app.message.error("Failed to unlink")
})
}
})
}
const onLink = async () => {
const response = await SyncModel.linkService(namespace).catch((err) => {
console.error(err)
app.message.error(err.message)
return null
})
if (!response) {
return null
}
app.message.info("Successfully linked account")
}
if (!namespace) {
return null
}
if (!props.ctx.processedCtx.publicData) {
return null
}
if (props.ctx.processedCtx.publicData[namespace]) {
return <div className="syncButton">
<div className="syncButton_info">
{
props.ctx.processedCtx.publicData[namespace].avatar
? <img
src={props.ctx.processedCtx.publicData[namespace].avatar}
alt="Account avatar"
/>
:
createIconRender(props.icon)
}
<p>
{
props.ctx.processedCtx.publicData[namespace].username
}
</p>
</div>
<div className="syncButton_actions">
<Button
onClick={onUnlink}
icon={<Icons.LogoutOutlined />}
>
Unlink
</Button>
</div>
</div>
}
return <Button
type="primary"
onClick={onLink}
>
Sync account
</Button>
}

View File

@ -1,52 +0,0 @@
.syncButton {
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
background-color: var(--background-color-primary);
padding: 10px;
border-radius: 12px;
.syncButton_info {
display: flex;
flex-direction: row;
align-items: center;
img {
width: 40px;
height: 40px;
object-fit: cover;
border-radius: 12px;
margin-right: 10px;
}
p {
font-size: 0.8rem;
font-weight: 500;
line-height: 1.5;
margin: 0;
}
}
.syncButton_actions {
display: flex;
align-items: center;
.ant-btn {
margin-left: 10px;
&:first-child {
margin-left: 0;
}
}
}
}

View File

@ -1,66 +0,0 @@
import loadable from "@loadable/component"
import SyncModel from "@models/sync"
// TODO: Make logout button require a valid session to be not disabled
export default {
id: "sync",
icon: "MdSync",
label: "Sync",
group: "advanced",
//disabled: true,
ctxData: async () => {
const spotifyAccount = await SyncModel.spotifyCore.getData().catch((err) => {
return null
})
const tidalData = await SyncModel.tidalCore.getCurrentUser().catch((err) => {
return null
})
return {
publicData: {
spotify: spotifyAccount,
tidal: tidalData,
}
}
},
settings: [
{
id: "sync_settings",
icon: "MdSync",
title: "Sync Settings",
description: "Sync your settings across all devices stored in the cloud",
group: "sync.settings",
component: "Switch",
disabled: true,
storaged: false,
},
{
id: "spotify",
icon: "SiSpotify",
title: "Spotify",
description: "Sync your Spotify account to get access to your playlists and other features",
group: "sync.accounts",
component: loadable(() => import("./components/syncAccountButton")),
props: {
icon: "SiSpotify",
namespace: "spotify"
},
storaged: false
},
{
id: "tidal",
icon: "SiTidal",
title: "Tidal",
description: "Sync your Tidal account to get access to your audio playback and playlists sync",
group: "sync.accounts",
component: loadable(() => import("./components/syncAccountButton")),
props: {
icon: "SiTidal",
namespace: "tidal"
},
storaged: false
}
]
}