Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions src/crates/core/src/miniapp/builtin/assets/coding-selfie/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,39 @@ html, body {
}
.cs-empty.is-error .cs-empty-art { color: var(--cs-del); }

.cs-empty-action {
margin-top: 12px;
padding: 8px 16px;
border-radius: var(--cs-radius-sm);
background: var(--cs-accent);
color: var(--cs-bg);
font-family: var(--cs-sans);
font-size: 13px;
font-weight: 500;
border: none;
cursor: pointer;
display: inline-flex;
align-items: center;
gap: 6px;
transition: background 140ms ease, transform 100ms ease;
flex-shrink: 0;
}
.cs-empty-action:hover {
background: var(--cs-accent-2);
}
.cs-empty-action:active {
transform: scale(0.97);
}
.cs-empty-action svg {
width: 14px;
height: 14px;
}

.cs-empty.has-action {
flex-direction: column;
align-items: flex-start;
}

/* ─── Adaptive: gracefully shed less-essential tiles ──
The dashboard prefers to fit on a single screen on ANY aspect ratio.
When space gets tight we hide optional blocks instead of overflowing. */
Expand Down
77 changes: 64 additions & 13 deletions src/crates/core/src/miniapp/builtin/assets/coding-selfie/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,8 @@ const I18N = {
errScan: '扫描失败',
errScanReason: (r) => `原因:${r}`,
errScanRuntime: '扫描出错',
errGitNotFound: '未检测到 Git',
errGitNotFoundDesc: '请先安装 Git 并确保已添加到系统环境变量中。',
styleNight: '凌晨刺客',
styleMorning: '早起鸟',
styleAm: '上午型选手',
Expand Down Expand Up @@ -222,6 +224,8 @@ const I18N = {
errScan: '掃描失敗',
errScanReason: (r) => `原因:${r}`,
errScanRuntime: '掃描出錯',
errGitNotFound: '未檢測到 Git',
errGitNotFoundDesc: '請先安裝 Git 並確保已添加到系統環境變量中。',
styleNight: '凌晨刺客',
styleMorning: '早起鳥',
styleAm: '上午型選手',
Expand Down Expand Up @@ -317,6 +321,8 @@ const I18N = {
errScan: 'Scan failed',
errScanReason: (r) => `reason: ${r}`,
errScanRuntime: 'Scan error',
errGitNotFound: 'Git not found',
errGitNotFoundDesc: 'Please install Git and ensure it is added to your system PATH.',
styleNight: 'Midnight Hacker',
styleMorning: 'Early Bird',
styleAm: 'Morning Brew',
Expand Down Expand Up @@ -389,23 +395,51 @@ function greetingFor(d, name) {
return t('greetWith')(part, name);
}

function setEmpty(state, title, desc, icon) {
function setEmpty(state, title, desc, icon, actionLabel, actionUrl) {
const el = $('empty');
el.classList.remove('is-loading', 'is-error');
if (state === 'loading') el.classList.add('is-loading');
if (state === 'error') el.classList.add('is-error');
$('empty-icon').innerHTML = icon || SVG.loader;
$('empty-title').textContent = title;
$('empty-desc').textContent = desc || '';
el.classList.remove('is-loading', 'is-error', 'has-action');
if (state === 'loading') el.classList.add('is-loading');
if (state === 'error') {
el.classList.add('is-error');
if (actionLabel && actionUrl) {
el.classList.add('has-action');
}
}
$('empty-icon').innerHTML = icon || SVG.loader;
$('empty-title').textContent = title;
$('empty-desc').textContent = desc || '';

const actionEl = $('empty-action');
if (actionLabel && actionUrl) {
if (!actionEl) {
actionEl = document.createElement('button');
actionEl.className = 'cs-empty-action';
actionEl.id = 'empty-action';
const container = $('empty');
container.appendChild(actionEl);
}
actionEl.textContent = actionLabel;
actionEl.onclick = () => {
if (window.app && window.app.system && window.app.system.openExternal) {
window.app.system.openExternal(actionUrl);
} else {
window.open(actionUrl, '_blank');
}
};
} else if (actionEl) {
actionEl.remove();
}
}
function showEmpty(state, title, desc, icon) {
setEmpty(state, title, desc, icon);
$('empty').removeAttribute('hidden');
$('content').setAttribute('hidden', '');

function showEmpty(state, title, desc, icon, actionLabel, actionUrl) {
setEmpty(state, title, desc, icon, actionLabel, actionUrl);
$('empty').removeAttribute('hidden');
$('content').setAttribute('hidden', '');
}

function hideEmpty() {
$('empty').setAttribute('hidden', '');
$('content').removeAttribute('hidden');
$('empty').setAttribute('hidden', '');
$('content').removeAttribute('hidden');
}

function renderDonut(langs) {
Expand Down Expand Up @@ -1280,6 +1314,15 @@ async function scanGitWorkspace(cwd) {
let lastData = null;
let scanning = false;

async function checkGitAvailable() {
try {
await window.app.shell.exec(['git', '--version'], { timeout: 5000 });
return true;
} catch (_e) {
return false;
}
}

async function scan() {
if (scanning) return;
scanning = true;
Expand All @@ -1293,6 +1336,14 @@ async function scan() {
return;
}

const gitAvailable = await checkGitAvailable();
if (!gitAvailable) {
showEmpty('error', t('errGitNotFound'), t('errGitNotFoundDesc'), SVG.gitBranch, t('errGitNotFoundAction'), t('gitDownloadUrl'));
lastData = null;
scanning = false;
return;
}

if (!lastData) {
showEmpty('loading', t('loadingTitle'), shortPath(ws), SVG.loader);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,6 @@ export const SETTINGS_TAB_SEARCH_CONTENT: Record<ConfigTab, readonly SettingsTab
{ ns: 'settings/session-config', key: 'features.workspaceSearch.enable' },
{ ns: 'settings/session-config', key: 'toolExecution.sectionTitle' },
{ ns: 'settings/session-config', key: 'toolExecution.sectionDescription' },
{ ns: 'settings/session-config', key: 'computerUse.sectionTitle' },
{ ns: 'settings/session-config', key: 'computerUse.sectionDescription' },
{ ns: 'settings/session-config', key: 'computerUse.enable' },
{ ns: 'settings/session-config', key: 'computerUse.enableDesc' },
{ ns: 'settings/session-config', key: 'browserControl.sectionTitle' },
{ ns: 'settings/session-config', key: 'browserControl.sectionDescription' },
{ ns: 'settings/agentic-tools', key: 'config.autoExecute' },
Expand Down
12 changes: 0 additions & 12 deletions src/web-ui/src/flow_chat/components/CoworkExampleCards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,13 @@ import React, { useCallback, useEffect, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import {
type LucideIcon,
Image,
Plane,
Presentation,
ListTodo,
CalendarDays,
ClipboardList,
Mail,
FileSpreadsheet,
HandCoins,
TrendingUp,
FileText,
X,
RotateCcw,
Plus,
Expand All @@ -25,16 +21,12 @@ import { Card, IconButton, Tooltip } from '@/component-library';
import './CoworkExampleCards.scss';

type ExampleId =
| 'desktop_cleanup'
| 'vacation_plan'
| 'make_ppt'
| 'todo_breakdown'
| 'optimize_week'
| 'weekly_plan'
| 'meeting_minutes'
| 'reply_email'
| 'make_docx'
| 'make_spreadsheet'
| 'budget_plan';

interface ExampleItem {
Expand All @@ -43,16 +35,12 @@ interface ExampleItem {
}

const EXAMPLES: ExampleItem[] = [
{ id: 'desktop_cleanup', icon: Image },
{ id: 'vacation_plan', icon: Plane },
{ id: 'make_ppt', icon: Presentation },
{ id: 'todo_breakdown', icon: ListTodo },
{ id: 'optimize_week', icon: TrendingUp },
{ id: 'weekly_plan', icon: CalendarDays },
{ id: 'meeting_minutes', icon: ClipboardList },
{ id: 'reply_email', icon: Mail },
{ id: 'make_docx', icon: FileText },
{ id: 'make_spreadsheet', icon: FileSpreadsheet },
{ id: 'budget_plan', icon: HandCoins },
];

Expand Down
Loading
Loading