fix tx isdone checkbox text size
This commit is contained in:
3
.env
3
.env
@@ -1,3 +1,4 @@
|
||||
# Базовые настройки для всех режимов
|
||||
VITE_APP_NAME=Space
|
||||
VITE_API_TIMEOUT=5000
|
||||
VITE_API_TIMEOUT=5000
|
||||
VITE_GOOGLE_CLIENT_ID=112729998586-q39qsptu67lqeej0356m01e1ghptuajk.apps.googleusercontent.com
|
||||
@@ -10,6 +10,7 @@
|
||||
<link rel="apple-touch-icon" href="/src/assets/1024.png">
|
||||
<link rel="stylesheet" href="/src/assets/main.css"/>
|
||||
<script src="https://telegram.org/js/telegram-web-app.js?59"></script>
|
||||
<script src="https://accounts.google.com/gsi/client" async defer></script>
|
||||
<title>Luminic Space</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
<script setup lang="ts">
|
||||
|
||||
import {onMounted, ref} from "vue";
|
||||
import {Divider, ToggleSwitch} from "primevue";
|
||||
import {Divider, ToggleSwitch, Button} from "primevue";
|
||||
import {spaceService} from "@/services/space-service";
|
||||
import {SettingType} from "@/models/enums";
|
||||
import {useUserStore} from "@/stores/userStore";
|
||||
|
||||
const userStore = useUserStore()
|
||||
const spacePeriodStarts = ref(10)
|
||||
const spaceSubPeriodStarts = ref(25)
|
||||
|
||||
@@ -87,6 +89,31 @@ const settingChanged = async (setting: SettingType) => {
|
||||
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
google: any;
|
||||
}
|
||||
}
|
||||
|
||||
const linkGoogleDrive = () => {
|
||||
if (typeof window.google === 'undefined') {
|
||||
console.error('Google client not loaded')
|
||||
return
|
||||
}
|
||||
|
||||
const client = window.google.accounts.oauth2.initCodeClient({
|
||||
client_id: import.meta.env.VITE_GOOGLE_CLIENT_ID,
|
||||
scope: 'https://www.googleapis.com/auth/drive.file https://www.googleapis.com/auth/drive.readonly',
|
||||
ux_mode: 'popup',
|
||||
callback: async (response: any) => {
|
||||
if (response.code) {
|
||||
await userStore.linkGoogleDrive(response.code)
|
||||
}
|
||||
},
|
||||
});
|
||||
client.requestCode();
|
||||
}
|
||||
|
||||
onMounted(async () => {
|
||||
await fetchData()
|
||||
})
|
||||
@@ -143,6 +170,25 @@ onMounted(async () => {
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="flex backup flex-col !w-full mt-2">
|
||||
<span class="text-sm !pl-2">Storage & Backup</span>
|
||||
<div class="flex card flex-col !w-full justify-between p-2">
|
||||
<div class="flex flex-row !w-full justify-between items-center">
|
||||
<div class="flex flex-col">
|
||||
<span>Google Drive</span>
|
||||
<span class="text-xs text-gray-500" v-if="userStore.user?.isGoogleDriveLinked">Connected</span>
|
||||
<span class="text-xs text-gray-500" v-else>Not connected</span>
|
||||
</div>
|
||||
<Button
|
||||
:label="userStore.user?.isGoogleDriveLinked ? 'Reconnect' : 'Connect'"
|
||||
:icon="userStore.user?.isGoogleDriveLinked ? 'pi pi-refresh' : 'pi pi-google'"
|
||||
:severity="userStore.user?.isGoogleDriveLinked ? 'secondary' : 'primary'"
|
||||
size="small"
|
||||
@click="linkGoogleDrive"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
1
src/env.d.ts
vendored
1
src/env.d.ts
vendored
@@ -5,6 +5,7 @@ interface ImportMetaEnv {
|
||||
readonly VITE_ENABLE_DEVTOOLS: boolean
|
||||
readonly VITE_APP_NAME: string
|
||||
readonly VITE_API_TIMEOUT: number
|
||||
readonly VITE_GOOGLE_CLIENT_ID: string
|
||||
// добавь сюда свои переменные, если есть
|
||||
// readonly VITE_APP_TITLE: string
|
||||
}
|
||||
|
||||
@@ -5,4 +5,5 @@ export interface User {
|
||||
tgId: number
|
||||
tdUserName: string;
|
||||
roles: string[];
|
||||
isGoogleDriveLinked?: boolean;
|
||||
}
|
||||
@@ -141,6 +141,24 @@ export const useUserStore = defineStore('user', () => {
|
||||
}
|
||||
}
|
||||
|
||||
async function linkGoogleDrive(code: string) {
|
||||
try {
|
||||
await apiClient.post('/auth/me/google-drive', {
|
||||
code: code
|
||||
});
|
||||
toast.add({severity: 'success', summary: 'Google Drive connected', detail: 'Successful!', life: 3000})
|
||||
await fetchUserProfile(); // refresh user info to get updated isGoogleDriveLinked
|
||||
} catch (error: any) {
|
||||
console.error(error);
|
||||
toast.add({
|
||||
severity: 'error',
|
||||
summary: 'Connection error',
|
||||
detail: error.response?.data?.message || 'Error occurred while linking Google Drive',
|
||||
life: 3000
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
return {user, loadingUser, fetchUserProfile, tgLogin, tgLoginData, register, isAuthorized};
|
||||
|
||||
return {user, loadingUser, fetchUserProfile, tgLogin, tgLoginData, register, linkGoogleDrive, isAuthorized};
|
||||
});
|
||||
|
||||
@@ -18,5 +18,8 @@ export default defineConfig(async ({mode}) => {
|
||||
'@': fileURLToPath(new URL('./src', import.meta.url)),
|
||||
},
|
||||
},
|
||||
optimizeDeps: {
|
||||
exclude: ['chart.js'],
|
||||
},
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user