|
|
@@ -0,0 +1,105 @@
|
|
|
+<script setup lang="ts">
|
|
|
+import { ref, computed } from 'vue'
|
|
|
+import { useI18n } from 'vue-i18n'
|
|
|
+import { useInstallStore } from '@/stores/install'
|
|
|
+
|
|
|
+const { t } = useI18n()
|
|
|
+const installStore = useInstallStore()
|
|
|
+
|
|
|
+const isLaunching = ref(false)
|
|
|
+const launchError = ref('')
|
|
|
+const launchSuccess = ref(false)
|
|
|
+
|
|
|
+const gitInstalled = computed(() => installStore.isInstalled('git'))
|
|
|
+
|
|
|
+const statusText = computed(() => {
|
|
|
+ if (isLaunching.value) return t('claudeCode.launching')
|
|
|
+ if (launchSuccess.value) return t('claudeCode.launchSuccess')
|
|
|
+ if (launchError.value) return launchError.value
|
|
|
+ if (!gitInstalled.value) return t('claudeCode.gitRequired')
|
|
|
+ return t('common.ready')
|
|
|
+})
|
|
|
+
|
|
|
+async function handleLaunch() {
|
|
|
+ if (isLaunching.value || !gitInstalled.value) return
|
|
|
+
|
|
|
+ isLaunching.value = true
|
|
|
+ launchError.value = ''
|
|
|
+ launchSuccess.value = false
|
|
|
+
|
|
|
+ try {
|
|
|
+ await window.electronAPI.launchClaudeCode()
|
|
|
+ launchSuccess.value = true
|
|
|
+ } catch (error) {
|
|
|
+ launchError.value = (error as Error).message || t('claudeCode.launchFailed')
|
|
|
+ } finally {
|
|
|
+ isLaunching.value = false
|
|
|
+ }
|
|
|
+}
|
|
|
+</script>
|
|
|
+
|
|
|
+<template>
|
|
|
+ <div class="claude-code-install">
|
|
|
+ <div class="software-info">
|
|
|
+ <h2>{{ t('software.claudeCode.name') }}</h2>
|
|
|
+ <p>{{ t('software.claudeCode.description') }}</p>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="info-card">
|
|
|
+ <el-alert type="info" :closable="false" show-icon>
|
|
|
+ <template #title>
|
|
|
+ {{ t('claudeCode.infoTitle') }}
|
|
|
+ </template>
|
|
|
+ <p>{{ t('claudeCode.infoDesc') }}</p>
|
|
|
+ </el-alert>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div v-if="!gitInstalled" class="warning-card">
|
|
|
+ <el-alert type="warning" :closable="false" show-icon>
|
|
|
+ <template #title>
|
|
|
+ {{ t('claudeCode.gitRequired') }}
|
|
|
+ </template>
|
|
|
+ <p>{{ t('claudeCode.gitRequiredDesc') }}</p>
|
|
|
+ </el-alert>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="button-group">
|
|
|
+ <el-button
|
|
|
+ type="primary"
|
|
|
+ :disabled="isLaunching || !gitInstalled"
|
|
|
+ :loading="isLaunching"
|
|
|
+ @click="handleLaunch"
|
|
|
+ >
|
|
|
+ {{ isLaunching ? t('claudeCode.launching') : t('claudeCode.launch') }}
|
|
|
+ </el-button>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="status-container">
|
|
|
+ <p :class="['status-text', { success: launchSuccess, error: !!launchError }]">
|
|
|
+ {{ statusText }}
|
|
|
+ </p>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+</template>
|
|
|
+
|
|
|
+<style scoped lang="scss">
|
|
|
+.claude-code-install {
|
|
|
+ .info-card {
|
|
|
+ margin-bottom: var(--spacing-md);
|
|
|
+
|
|
|
+ p {
|
|
|
+ margin: var(--spacing-sm) 0 0 0;
|
|
|
+ color: var(--text-color-secondary);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ .warning-card {
|
|
|
+ margin-bottom: var(--spacing-md);
|
|
|
+
|
|
|
+ p {
|
|
|
+ margin: var(--spacing-sm) 0 0 0;
|
|
|
+ color: var(--text-color-secondary);
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|
|
|
+</style>
|