feat: bind/unbind by id, video streaming proxy, unmute default, library refresh, hamburger click-outside
- Core API: bind/unbind accept id (integer PK) when face_id is null - Tauri proxy: stream video responses instead of buffering for seek bar - VideoPlayer: remove muted attribute, unmute by default - LibraryView: call invalidateFiles() before ensureFiles() on register/unregister - PeopleView: close sort panel on click-outside, not just hamburger toggle - bind_face: prefer face_id, fallback to id when face_id is null
This commit is contained in:
@@ -7,6 +7,13 @@
|
||||
</svg>
|
||||
返回
|
||||
</button>
|
||||
<button v-if="!isEditing" class="ms-ppl-edit-text-btn" @click="startEditing">
|
||||
編輯
|
||||
<svg width="13" height="13" viewBox="0 0 24 24" fill="none" style="margin-left:4px;">
|
||||
<path d="M11 4H4a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path>
|
||||
<path d="M18.5 2.5a2.121 2.121 0 0 1 3 3L12 15l-4 1 1-4 9.5-9.5z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<div v-if="loading" class="loading-state">
|
||||
@@ -16,18 +23,26 @@
|
||||
<template v-else-if="person">
|
||||
<div class="ms-ppl-detail-header">
|
||||
<div style="display:flex;flex-direction:column;align-items:center;gap:8px;flex-shrink:0;">
|
||||
<div class="ms-ppl-detail-avatar">
|
||||
<img v-if="profile" :src="profile" alt="">
|
||||
<div class="ms-ppl-detail-avatar" :class="{ 'ms-ppl-avatar-editable': isEditing }" @click="isEditing && triggerAvatarUpload()">
|
||||
<img v-if="profile" :src="profile" alt="" style="width:100%;height:100%;object-fit:cover;">
|
||||
<svg v-else class="ms-silhouette" viewBox="0 0 120 120" fill="none">
|
||||
<circle cx="60" cy="45" r="25" fill="#d1d5db"/>
|
||||
<ellipse cx="60" cy="105" rx="40" ry="25" fill="#d1d5db"/>
|
||||
</svg>
|
||||
<div v-if="isEditing" class="ms-ppl-avatar-upload-hint">
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none">
|
||||
<path d="M23 19a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h4l2-3h6l2 3h4a2 2 0 0 1 2 2z" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<circle cx="12" cy="13" r="4" stroke="currentColor" stroke-width="1.5"/>
|
||||
</svg>
|
||||
</div>
|
||||
</div>
|
||||
<input ref="fileInput" type="file" accept="image/jpeg,image/png" style="display:none" @change="handleAvatarUpload">
|
||||
</div>
|
||||
<div style="flex:1;min-width:0;">
|
||||
<div id="msPplInfoView">
|
||||
<!-- View mode -->
|
||||
<div v-if="!isEditing" id="msPplInfoView">
|
||||
<div class="ms-ppl-detail-name-row">
|
||||
<button class="ms-ppl-star-btn" :class="{ starred: person.starred }" @click="toggleStar">☆</button>
|
||||
<button class="ms-ppl-star-btn" :class="{ starred: person.starred }" @click="toggleStar">{{ person.starred ? '★' : '☆' }}</button>
|
||||
<div class="ms-ppl-view-box ms-ppl-view-name-box">{{ person.name || '—' }}</div>
|
||||
</div>
|
||||
<div class="ms-ppl-detail-aliases" v-if="person.metadata?.aliases?.length">
|
||||
@@ -44,49 +59,129 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Edit mode -->
|
||||
<div v-else id="msPplInfoEdit">
|
||||
<div class="ms-ppl-edit-row ms-ppl-edit-name-row">
|
||||
<button class="ms-ppl-star-btn" :class="{ starred: person.starred }" @click="toggleStar">{{ person.starred ? '★' : '☆' }}</button>
|
||||
<input v-model="editName" class="ms-ppl-edit-input ms-ppl-edit-name-input" placeholder="加入人名">
|
||||
</div>
|
||||
<div class="ms-ppl-edit-row ms-ppl-edit-alias-row">
|
||||
<div class="ms-ppl-alias-wrap-inner">
|
||||
<span v-for="(a, i) in editAliases" :key="i" class="ms-ppl-alias-tag">
|
||||
{{ a.name }}
|
||||
<button @click="removeAlias(i)">×</button>
|
||||
</span>
|
||||
</div>
|
||||
<template v-if="showAliasInput">
|
||||
<select v-model="aliasLocale" class="ms-ppl-alias-locale-select">
|
||||
<option value="en">English</option>
|
||||
<option value="zh-TW">繁體中文</option>
|
||||
<option value="zh-CN">简体中文</option>
|
||||
<option value="ja">日本語</option>
|
||||
<option value="ko">한국어</option>
|
||||
</select>
|
||||
<input v-model="aliasName" class="ms-ppl-alias-inline-input" placeholder="輸入別名後按 Enter" @keyup.enter="addAlias">
|
||||
</template>
|
||||
<button v-if="!showAliasInput" class="ms-ppl-alias-add-btn" @click="showAliasInput = true; aliasName = ''">+ 別名</button>
|
||||
<button v-else class="ms-ppl-alias-add-btn" @click="showAliasInput = false">收起</button>
|
||||
</div>
|
||||
<div class="ms-ppl-edit-fields">
|
||||
<div class="ms-ppl-edit-field-row">
|
||||
<label class="ms-ppl-edit-label">角色</label>
|
||||
<input v-model="editRole" class="ms-ppl-edit-input ms-ppl-edit-field-input" placeholder="角色名稱">
|
||||
</div>
|
||||
<div class="ms-ppl-edit-field-row ms-ppl-edit-field-row--top">
|
||||
<label class="ms-ppl-edit-label">描述</label>
|
||||
<textarea v-model="editNotes" class="ms-ppl-edit-textarea ms-ppl-edit-field-input" placeholder="自訂描述"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ms-ppl-edit-actions">
|
||||
<button class="ms-fm-btn ms-fm-btn-primary" @click="saveEdit" :disabled="saving">{{ saving ? '儲存中...' : '✓ 儲存更改' }}</button>
|
||||
<button class="ms-fm-btn" @click="cancelEditing">取消</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ms-ppl-strip-wrap">
|
||||
<div class="ms-ppl-strip-wrap" :class="{ 'ms-ppl-edit-mode': isEditing }">
|
||||
<button class="ms-ppl-strip-add-btn" @click="showCandidates = true" title="加入相同人物">+</button>
|
||||
<div class="ms-ppl-face-strip">
|
||||
<div v-for="f in faces.slice(0, 30)" :key="f.id" class="ms-ppl-strip-face">
|
||||
<div v-if="loadingFaces" style="padding:10px;color:#999;font-size:12px;">Loading faces...</div>
|
||||
<div v-else-if="faces.length === 0" style="padding:10px;color:#999;font-size:12px;">No faces found</div>
|
||||
<div v-for="f in faces.slice(0, showAllFaces ? faces.length : 30)" :key="f.id" class="ms-ppl-strip-face ms-ppl-strip-face-clickable" :class="{ selected: selectedFace?.id === f.id }" @click="selectFace(f)" @contextmenu.prevent="showFaceCtxMenu($event, f)">
|
||||
<div class="ms-ppl-strip-face-img">
|
||||
<img v-if="f.thumbUrl" :src="f.thumbUrl" alt="" loading="lazy" style="width:100%;height:100%;object-fit:cover;border-radius:8px;">
|
||||
<img v-if="faceThumbs[f.id]" :src="faceThumbs[f.id]" alt="" loading="lazy" style="width:100%;height:100%;object-fit:cover;border-radius:8px;">
|
||||
<div v-else style="width:100%;height:100%;display:flex;align-items:center;justify-content:center;background:#eef2ff;color:#6366f1;font-size:14px;font-weight:600;border-radius:8px;">{{ Math.round(f.confidence * 100) }}%</div>
|
||||
</div>
|
||||
<button v-if="isEditing" class="ms-ppl-strip-remove-btn" @click="unbindFace(f)">×</button>
|
||||
</div>
|
||||
</div>
|
||||
<button v-if="faces.length > 30" class="ms-ppl-strip-arrow" @click="showAllFaces = !showAllFaces">›</button>
|
||||
</div>
|
||||
|
||||
<div class="ms-ppl-media-label" v-if="mergedTraces.length">{{ mergedTraces.length }} segments</div>
|
||||
<div class="ms-ppl-media-grid">
|
||||
<div v-for="(m, i) in mergedTraces.slice(0, 20)" :key="i" class="ms-ppl-media-item" @click="playVideo(m.file_uuid, m.start, m.end)">
|
||||
<div class="ms-ppl-media-thumb">
|
||||
<img v-if="m.thumbUrl" :src="m.thumbUrl" alt="" loading="lazy" style="width:100%;height:100%;object-fit:cover;" @error="handleThumbError">
|
||||
<div class="ms-thumb-play-circle">
|
||||
<svg width="20" height="20" viewBox="0 0 24 24"><polygon points="6,4 20,12 6,20" fill="white"/></svg>
|
||||
</div>
|
||||
<span class="ms-ppl-media-dur">{{ (m.end - m.start).toFixed(1) }}s</span>
|
||||
</div>
|
||||
<div class="ms-ppl-media-info">
|
||||
<div class="ms-ppl-media-title">{{ m.count > 1 ? 'Merged ' + m.count + ' segments' : 'Segment' }}</div>
|
||||
<div class="ms-ppl-media-sub">{{ m.start.toFixed(1) }}s - {{ m.end.toFixed(1) }}s</div>
|
||||
<!-- Face detail card -->
|
||||
<div v-if="selectedFace" class="ms-ppl-face-card-detail">
|
||||
<button class="ms-ppl-face-card-close" @click="selectedFace = null">×</button>
|
||||
<div class="ms-ppl-face-card-img-wrap">
|
||||
<img v-if="faceThumbs[selectedFace.id]" :src="faceThumbs[selectedFace.id]" alt="" style="width:100%;height:100%;object-fit:cover;border-radius:12px;">
|
||||
<div v-else class="face-placeholder">?</div>
|
||||
</div>
|
||||
<div class="ms-ppl-face-card-info">
|
||||
<div class="ms-ppl-face-card-file">{{ (selectedFace.file_uuid || '').slice(0, 12) }}...</div>
|
||||
<div class="ms-ppl-face-card-frame">Frame #{{ selectedFace.frame_number }}</div>
|
||||
<div v-if="selectedFace.confidence" class="ms-ppl-face-card-conf">Confidence: {{ (selectedFace.confidence * 100).toFixed(1) }}%</div>
|
||||
<div class="ms-ppl-face-card-actions">
|
||||
<button class="ms-fm-btn" @click="playFaceTrace(selectedFace)">▶ 播放片段</button>
|
||||
<button v-if="isEditing" class="ms-fm-btn ms-fm-btn-danger" @click="unbindFace(selectedFace); selectedFace = null">✕ 解綁</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="ms-ppl-delete-zone">
|
||||
<hr class="ms-ppl-delete-hr">
|
||||
<button class="ms-fm-btn ms-ppl-delete-zone-btn" @click="confirmDelete">
|
||||
<svg width="14" height="14" viewBox="0 0 24 24" fill="none">
|
||||
<polyline points="3 6 5 6 21 6" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></polyline>
|
||||
<path d="M19 6l-1 14H6L5 6" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path>
|
||||
<path d="M10 11v6M14 11v6" stroke="currentColor" stroke-width="2" stroke-linecap="round"></path>
|
||||
</svg>
|
||||
刪除此人物
|
||||
</button>
|
||||
<!-- Segment card -->
|
||||
<div v-if="mergedSegments.length" class="ms-ppl-media-item segment-card" @click="playMerged(mergedSegments[0])">
|
||||
<div class="ms-ppl-media-thumb">
|
||||
<img v-if="thumbs[mergedSegments[0].thumbKey]" :src="thumbs[mergedSegments[0].thumbKey]" alt="" loading="lazy" style="width:100%;height:100%;object-fit:cover;">
|
||||
<div class="ms-thumb-play-circle">
|
||||
<svg width="20" height="20" viewBox="0 0 24 24"><polygon points="6,4 20,12 6,20" fill="white"/></svg>
|
||||
</div>
|
||||
<span class="ms-ppl-media-dur">{{ (mergedSegments[0].end - mergedSegments[0].start).toFixed(1) }}s</span>
|
||||
<span v-if="mergedSegments[0].avg_confidence" class="ms-ppl-media-badge-conf">{{ (mergedSegments[0].avg_confidence * 100).toFixed(0) }}%</span>
|
||||
</div>
|
||||
<div class="ms-ppl-media-info">
|
||||
<div class="ms-ppl-media-title">{{ mergedSegments[0].count > 1 ? 'Merged ' + mergedSegments[0].count + ' segments' : 'Segment' }} · {{ mergedSegments[0].file_uuid.slice(0,8) }}...</div>
|
||||
<div class="ms-ppl-media-sub">#{{ mergedSegments[0].start_frame }} — #{{ mergedSegments[0].end_frame }} · {{ formatTime(mergedSegments[0].start) }}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div v-if="loadingTraces" class="ms-ppl-media-label" style="margin-bottom:20px;">Loading segments...</div>
|
||||
<div v-else-if="!mergedSegments.length" class="ms-ppl-media-label" style="margin-bottom:20px;">No trace segments available for this person</div>
|
||||
|
||||
<!-- Tabs -->
|
||||
<div v-show="activeTab === 'actions'">
|
||||
<div class="ms-ppl-actions-section">
|
||||
<div class="ms-ppl-actions-status">
|
||||
<span class="ms-ppl-actions-label">狀態:</span>
|
||||
<span class="ms-ppl-actions-value">{{ person.status || 'confirmed' }}</span>
|
||||
<button v-if="person.status !== 'confirmed'" class="ms-fm-btn ms-fm-btn-primary" @click="updateStatus('confirmed')">✓ 確認</button>
|
||||
<button v-if="person.status !== 'pending'" class="ms-fm-btn" @click="updateStatus('pending')">待定</button>
|
||||
<button v-if="person.status !== 'skipped'" class="ms-fm-btn" @click="updateStatus('skipped')">略過</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="ms-ppl-actions-section" style="margin-top:16px;">
|
||||
<button class="ms-fm-btn ms-fm-btn-primary" @click="showCandidates = true" style="margin-bottom:8px;">+ 綁定人臉</button>
|
||||
<button class="ms-fm-btn ms-fm-btn-blue" @click="showMerge = true" style="margin-bottom:8px;">⇄ 合併到其他人物</button>
|
||||
</div>
|
||||
|
||||
<div class="ms-ppl-delete-zone">
|
||||
<hr class="ms-ppl-delete-hr">
|
||||
<button class="ms-fm-btn ms-ppl-delete-zone-btn" @click="confirmDelete">
|
||||
<svg width="14" height="14" viewBox="0 0 24 24" fill="none">
|
||||
<polyline points="3 6 5 6 21 6" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></polyline>
|
||||
<path d="M19 6l-1 14H6L5 6" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path>
|
||||
<path d="M10 11v6M14 11v6" stroke="currentColor" stroke-width="2" stroke-linecap="round"></path>
|
||||
</svg>
|
||||
刪除此人物
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
<div v-else class="empty">
|
||||
@@ -102,7 +197,7 @@
|
||||
<div class="ms-merge-grid">
|
||||
<div v-for="c in candidates" :key="c.id" class="ms-merge-face-card" @click="bindCandidate(c)">
|
||||
<div class="ms-merge-face-img">
|
||||
<img v-if="c.thumbUrl" :src="c.thumbUrl" alt="">
|
||||
<img v-if="faceThumbs[c.thumbKey]" :src="faceThumbs[c.thumbKey]" alt="">
|
||||
<div v-else class="face-placeholder">{{ Math.round(c.confidence * 100) }}%</div>
|
||||
</div>
|
||||
<span class="ms-merge-face-name">{{ c.file_uuid?.slice(0, 8) }}... #{{ c.frame_number }}</span>
|
||||
@@ -112,63 +207,101 @@
|
||||
</div>
|
||||
|
||||
<div v-if="showMerge" class="ms-modal-overlay show" @click.self="showMerge = false">
|
||||
<div class="ms-modal">
|
||||
<div class="ms-modal ms-modal-merge">
|
||||
<button class="ms-fm-icon-btn close-btn" @click="showMerge = false">×</button>
|
||||
<h2 class="ms-ppl-section-title">Merge Identity</h2>
|
||||
<input v-model="mergeTarget" class="merge-input" placeholder="Target identity UUID" />
|
||||
<div class="ms-modal-actions">
|
||||
<button class="ms-fm-btn ms-fm-btn-blue" :disabled="!mergeTarget" @click="confirmMerge">Merge</button>
|
||||
<h2 class="ms-ppl-section-title">⇄ 合併到其他人物</h2>
|
||||
<div class="ms-merge-search-wrap">
|
||||
<span class="ms-merge-search-icon">🔍</span>
|
||||
<input v-model="mergeSearchQuery" class="ms-merge-search-input" placeholder="搜尋人物名稱..." @input="onMergeSearch" />
|
||||
</div>
|
||||
<div class="ms-merge-grid">
|
||||
<div v-for="r in mergeSearchResults" :key="r.identity_id" class="ms-merge-face-card" @click="confirmMergeTarget(r)">
|
||||
<div class="ms-merge-face-img">
|
||||
<svg viewBox="0 0 120 120" fill="none" style="width:100%;height:100%;">
|
||||
<circle cx="60" cy="45" r="25" fill="#d1d5db"/>
|
||||
<ellipse cx="60" cy="105" rx="40" ry="25" fill="#d1d5db"/>
|
||||
</svg>
|
||||
</div>
|
||||
<span class="ms-merge-face-name">{{ r.name }}</span>
|
||||
</div>
|
||||
<div v-if="!mergeSearchResults.length && mergeSearchQuery" class="ms-merge-face-card" style="opacity:0.5;cursor:default;width:100%;padding:20px;text-align:center;">
|
||||
No results found
|
||||
</div>
|
||||
</div>
|
||||
<div class="ms-merge-footer">
|
||||
<button class="ms-fm-btn" @click="showMerge = false">取消</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<VideoPlayer v-if="playing" :file-uuid="currentVideo.fileUuid" :start-time="currentVideo.startTime" :end-time="currentVideo.endTime" :title="currentVideo.title" @close="playing = false" />
|
||||
<VideoPlayer v-if="playing" :file-uuid="currentVideo.fileUuid" :start-time="currentVideo.startTime" :end-time="currentVideo.endTime" :all-traces="allTraces" :initial-trace-idx="currentVideo.traceIdx" :title="currentVideo.title" @close="playing = false" />
|
||||
|
||||
<!-- Face strip context menu -->
|
||||
<div v-if="faceCtxMenu.show" class="ms-ctx-menu" :style="{ left: faceCtxMenu.x + 'px', top: faceCtxMenu.y + 'px', display: 'block' }" @click.stop @mousedown.stop @pointerdown.stop>
|
||||
<button class="ms-ctx-item ms-ctx-danger" @click="faceCtxAction('unbind')">不是此人物</button>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { ref, onMounted } from 'vue'
|
||||
import { ref, computed, onMounted, onUnmounted, watch } from 'vue'
|
||||
import { useRoute, useRouter } from 'vue-router'
|
||||
import { invoke } from '@tauri-apps/api/core'
|
||||
import VideoPlayer from '../components/VideoPlayer.vue'
|
||||
import { apiCall } from '@/api'
|
||||
import { isTauri } from '@/api/config'
|
||||
import { ensurePeople, peopleCache, peopleLoaded, profilesCache, loadProfile as storeLoadProfile, faceThumbsCache, loadFaceThumb as storeLoadFaceThumb, thumbnailsCache, invalidatePeople, invalidateProfile } from '@/store'
|
||||
import VideoPlayer from '@/components/VideoPlayer.vue'
|
||||
|
||||
const route = useRoute()
|
||||
const router = useRouter()
|
||||
|
||||
const person = ref<any>(null)
|
||||
const loading = ref(true)
|
||||
const loadingFaces = ref(true)
|
||||
const loadingTraces = ref(true)
|
||||
const profile = ref('')
|
||||
const profileUuid = ref('')
|
||||
const peopleCount = ref(0)
|
||||
const allPeople = ref<any[]>([])
|
||||
const faces = ref<any[]>([])
|
||||
const traces = ref<any[]>([])
|
||||
const mergedTraces = ref<any[]>([])
|
||||
const allTraces = ref<any[]>([])
|
||||
const mergedSegments = ref<any[]>([])
|
||||
const playing = ref(false)
|
||||
const currentVideo = ref({ fileUuid: '', startTime: 0, endTime: 0, title: '' })
|
||||
const currentVideo = ref({ fileUuid: '', startTime: 0, endTime: 0, traceIdx: 0, title: '' })
|
||||
const showCandidates = ref(false)
|
||||
const showMerge = ref(false)
|
||||
const mergeTarget = ref('')
|
||||
const mergeSearchQuery = ref('')
|
||||
const mergeSearchResults = ref<any[]>([])
|
||||
const candidates = ref<any[]>([])
|
||||
const showAllFaces = ref(false)
|
||||
|
||||
const CORE_API = 'http://localhost:3002'
|
||||
const API_KEY = 'muser_68600856036340bcafc01930eb4bd839_1774418104_97221b69'
|
||||
const thumbs = thumbnailsCache
|
||||
const faceThumbs = faceThumbsCache
|
||||
const isEditing = ref(false)
|
||||
const editName = ref('')
|
||||
const editRole = ref('')
|
||||
const editNotes = ref('')
|
||||
const editAliases = ref<{name: string, locale: string}[]>([])
|
||||
const showAliasInput = ref(false)
|
||||
const aliasLocale = ref('zh-TW')
|
||||
const aliasName = ref('')
|
||||
const saving = ref(false)
|
||||
const avatarUploading = ref(false)
|
||||
const activeTab = ref<'faces' | 'actions'>('faces')
|
||||
const faceCtxMenu = ref({ show: false, x: 0, y: 0, face: null as any })
|
||||
const selectedFace = ref<any>(null)
|
||||
const fileInput = ref<HTMLInputElement | null>(null)
|
||||
|
||||
onMounted(async () => {
|
||||
const uuid = route.params.uuid as string
|
||||
console.log('PersonDetailView mounted, uuid:', uuid)
|
||||
try {
|
||||
console.log('Calling getPeople with uuid:', uuid)
|
||||
const people: any = await invoke('get_people', { page: 1, perPage: 1000 })
|
||||
console.log('getPeople raw result:', JSON.stringify(people).slice(0, 200))
|
||||
console.log('getPeople result count:', Array.isArray(people) ? people.length : 'not array')
|
||||
peopleCount.value = Array.isArray(people) ? people.length : 0
|
||||
const found = (Array.isArray(people) ? people : []).find((p: any) => p.identityUuid === uuid)
|
||||
console.log('Person found:', !!found, found?.name)
|
||||
await ensurePeople()
|
||||
peopleCount.value = peopleCache.value.length
|
||||
allPeople.value = peopleCache.value
|
||||
const found = allPeople.value.find((p: any) => p.identity_uuid === uuid)
|
||||
if (found) {
|
||||
person.value = { ...found, status: found.status || 'confirmed' }
|
||||
await loadProfile(uuid)
|
||||
await loadFaces(uuid)
|
||||
await loadMedia(uuid)
|
||||
loadProfile(uuid)
|
||||
loadFaces(uuid)
|
||||
loadMedia(uuid)
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Failed to load person:', e)
|
||||
@@ -176,99 +309,335 @@ onMounted(async () => {
|
||||
loading.value = false
|
||||
}
|
||||
loadCandidates()
|
||||
document.addEventListener('click', closeFaceCtxMenu)
|
||||
})
|
||||
|
||||
async function loadProfile(uuid: string) {
|
||||
try { profile.value = await invoke('get_identity_profile', { uuid }) } catch {}
|
||||
onUnmounted(() => {
|
||||
document.removeEventListener('click', closeFaceCtxMenu)
|
||||
})
|
||||
|
||||
function loadProfile(uuid: string) {
|
||||
profileUuid.value = uuid
|
||||
if (profilesCache.value[uuid]) {
|
||||
profile.value = profilesCache.value[uuid]
|
||||
} else {
|
||||
storeLoadProfile(uuid)
|
||||
}
|
||||
}
|
||||
|
||||
watch(() => profileUuid.value && profilesCache.value[profileUuid.value], (val) => {
|
||||
if (val && !profile.value) profile.value = val
|
||||
})
|
||||
|
||||
function thumbKey(uuid: string, frame: number): string {
|
||||
return `${uuid}:${frame}`
|
||||
}
|
||||
|
||||
async function loadFaces(uuid: string) {
|
||||
loadingFaces.value = true
|
||||
try {
|
||||
const result: any = await invoke('getFaces', { uuid, perPage: 1000 })
|
||||
const result: any = await apiCall('get_faces', { uuid, perPage: 20 })
|
||||
const items = Array.isArray(result) ? result : []
|
||||
faces.value = items.map((f: any) => ({
|
||||
...f,
|
||||
thumbUrl: f.file_uuid ? `${CORE_API}/api/v1/file/${f.file_uuid}/thumbnail?api_key=${API_KEY}&frame=${f.frame_number || 0}` : ''
|
||||
}))
|
||||
faces.value = items
|
||||
items.forEach((f: any) => {
|
||||
const fu = f.file_uuid || f.fileUuid || ''
|
||||
const fn = f.frame_number ?? f.frameNumber ?? 0
|
||||
const fid = f.id
|
||||
const bbox = f.bbox
|
||||
storeLoadFaceThumb(fid, fu, fn, bbox)
|
||||
})
|
||||
} catch (e) { console.error('Failed to load faces:', e) }
|
||||
finally { loadingFaces.value = false }
|
||||
}
|
||||
|
||||
function selectFace(f: any) {
|
||||
selectedFace.value = f
|
||||
}
|
||||
|
||||
function playFaceTrace(f: any) {
|
||||
const fu = f.file_uuid || f.fileUuid || ''
|
||||
const frame = f.frame_number ?? f.frameNumber ?? 0
|
||||
const trace = allTraces.value.find((t: any) => t.file_uuid === fu && frame >= (t.first_frame || t.start_frame || 0) && frame <= (t.last_frame || t.end_frame || 0))
|
||||
if (trace) {
|
||||
currentVideo.value = {
|
||||
fileUuid: fu,
|
||||
startTime: trace.first_sec || trace.start_time || 0,
|
||||
endTime: trace.last_sec || trace.end_time || 0,
|
||||
traceIdx: allTraces.value.indexOf(trace),
|
||||
title: `${person.value?.name} · Face #${frame}`,
|
||||
}
|
||||
} else {
|
||||
currentVideo.value = {
|
||||
fileUuid: fu,
|
||||
startTime: Math.max(0, (frame / 30) - 5),
|
||||
endTime: (frame / 30) + 5,
|
||||
traceIdx: 0,
|
||||
title: `${person.value?.name} · Face #${frame}`,
|
||||
}
|
||||
}
|
||||
playing.value = true
|
||||
}
|
||||
|
||||
function showFaceCtxMenu(e: MouseEvent, f: any) {
|
||||
e.preventDefault()
|
||||
e.stopPropagation()
|
||||
faceCtxMenu.value = { show: true, x: e.clientX, y: e.clientY, face: { ...f } }
|
||||
}
|
||||
|
||||
function closeFaceCtxMenu(e?: MouseEvent) {
|
||||
faceCtxMenu.value.show = false
|
||||
}
|
||||
|
||||
function faceCtxAction(action: string) {
|
||||
const f = faceCtxMenu.value.face
|
||||
faceCtxMenu.value = { show: false, x: 0, y: 0, face: null }
|
||||
if (!f) {
|
||||
console.error('faceCtxAction: no face data')
|
||||
return
|
||||
}
|
||||
if (!person.value) {
|
||||
console.error('faceCtxAction: no person data')
|
||||
return
|
||||
}
|
||||
if (action === 'unbind') {
|
||||
unbindFace(f)
|
||||
}
|
||||
}
|
||||
|
||||
async function loadMedia(uuid: string) {
|
||||
loadingTraces.value = true
|
||||
try {
|
||||
const result: any = await invoke('getTraces', { uuid, perPage: 1000 })
|
||||
const result: any = await apiCall('get_traces', { uuid, perPage: 50 })
|
||||
const rawItems = Array.isArray(result) ? result : []
|
||||
rawItems.sort((a: any, b: any) => (a.first_sec || 0) - (b.first_sec || 0))
|
||||
|
||||
if (!rawItems.length) { mergedSegments.value = []; return }
|
||||
|
||||
rawItems.sort((a: any, b: any) => (a.first_sec || a.start_time || 0) - (b.first_sec || b.start_time || 0))
|
||||
allTraces.value = rawItems
|
||||
|
||||
const merged: any[] = []
|
||||
let cur: any = null
|
||||
rawItems.forEach((item: any) => {
|
||||
const st = item.first_sec || 0
|
||||
const en = item.last_sec || 0
|
||||
rawItems.forEach((item: any, idx: number) => {
|
||||
const st = item.first_sec || item.start_time || 0
|
||||
const en = item.last_sec || item.end_time || 0
|
||||
const fu = item.file_uuid || ''
|
||||
if (cur && fu === cur.file_uuid && (st - cur.end) < 30) {
|
||||
cur.end = Math.max(cur.end, en)
|
||||
cur.end_frame = Math.max(cur.end_frame, item.last_frame || 0)
|
||||
cur.count++
|
||||
cur._endIdx = idx
|
||||
cur.total_confidence += item.avg_confidence || 0
|
||||
} else {
|
||||
if (cur) merged.push(cur)
|
||||
cur = { file_uuid: fu, start: st, end: en, count: 1, first_frame: item.first_frame || 0 }
|
||||
cur = {
|
||||
file_uuid: fu,
|
||||
start_frame: item.first_frame || 0,
|
||||
end_frame: item.last_frame || 0,
|
||||
start: st,
|
||||
end: en,
|
||||
count: 1,
|
||||
total_confidence: item.avg_confidence || 0,
|
||||
_startIdx: idx,
|
||||
_endIdx: idx,
|
||||
thumbKey: thumbKey(fu, item.first_frame || 0),
|
||||
}
|
||||
}
|
||||
})
|
||||
if (cur) merged.push(cur)
|
||||
|
||||
mergedTraces.value = merged.map((m: any) => ({
|
||||
...m,
|
||||
thumbUrl: m.file_uuid ? `${CORE_API}/api/v1/file/${m.file_uuid}/thumbnail?api_key=${API_KEY}&frame=${m.first_frame || Math.floor(m.start * 24)}` : ''
|
||||
}))
|
||||
|
||||
merged.forEach((m: any) => {
|
||||
m.avg_confidence = m.count > 1 ? m.total_confidence / m.count : m.total_confidence
|
||||
delete m.total_confidence
|
||||
})
|
||||
mergedSegments.value = merged.slice(0, 1)
|
||||
merged.forEach((m: any) => loadThumb(m.file_uuid, m.start_frame))
|
||||
} catch (e) { console.error('Failed to load media:', e) }
|
||||
finally { loadingTraces.value = false }
|
||||
}
|
||||
|
||||
function loadThumb(uuid: string, frame: number) {
|
||||
const key = thumbKey(uuid, frame)
|
||||
if (thumbnailsCache.value[key]) return
|
||||
apiCall('get_thumbnail', { uuid, frame }).then((url: any) => {
|
||||
if (url) thumbnailsCache.value[key] = url
|
||||
}).catch(() => {})
|
||||
}
|
||||
|
||||
async function loadCandidates() {
|
||||
try {
|
||||
const result: any = await invoke('get_face_candidates', { page: 1, perPage: 100 })
|
||||
const result: any = await apiCall('get_face_candidates', { page: 1, perPage: 20 })
|
||||
candidates.value = (Array.isArray(result) ? result : []).map((c: any) => ({
|
||||
...c,
|
||||
thumbUrl: c.file_uuid ? `${CORE_API}/api/v1/file/${c.file_uuid}/thumbnail?api_key=${API_KEY}&frame=${c.frame_number || 0}` : ''
|
||||
thumbKey: `cand_${c.id}`
|
||||
}))
|
||||
;(Array.isArray(result) ? result : []).forEach((c: any) => loadFaceCandidateThumb(c))
|
||||
} catch (e) { console.error('Failed to load candidates:', e) }
|
||||
}
|
||||
|
||||
function handleThumbError(e: Event) {
|
||||
const img = e.target as HTMLImageElement
|
||||
img.style.display = 'none'
|
||||
async function loadFaceCandidateThumb(c: any) {
|
||||
if (!c?.file_uuid) return
|
||||
storeLoadFaceThumb(`cand_${c.id}`, c.file_uuid, c.frame_number || 0, c.bbox)
|
||||
}
|
||||
|
||||
async function toggleStar() {
|
||||
if (!person.value) return
|
||||
person.value.starred = !person.value.starred
|
||||
const newVal = !person.value.starred
|
||||
try {
|
||||
await apiCall('update_identity_starred', { uuid: person.value.identity_uuid, starred: newVal })
|
||||
person.value.starred = newVal
|
||||
invalidatePeople()
|
||||
} catch (e) {
|
||||
console.error('Failed to update star:', e)
|
||||
}
|
||||
}
|
||||
|
||||
async function confirmDelete() {
|
||||
if (!person.value || !confirm(`Delete "${person.value.name}"?`)) return
|
||||
try {
|
||||
await invoke('delete_identity', { uuid: person.value.identityUuid })
|
||||
await apiCall('delete_identity', { uuid: person.value.identity_uuid })
|
||||
router.back()
|
||||
} catch (e) { console.error('Failed to delete:', e) }
|
||||
}
|
||||
|
||||
async function bindCandidate(c: any) {
|
||||
if (!person.value) return
|
||||
const fid = c.face_id || String(c.id)
|
||||
try {
|
||||
await invoke('bind_face', { uuid: person.value.identityUuid, faceId: String(c.id), fileUuid: c.file_uuid })
|
||||
await apiCall('bind_face', { uuid: person.value.identity_uuid, faceId: fid, faceRowId: c.face_id ? undefined : c.id, fileUuid: c.file_uuid })
|
||||
showCandidates.value = false
|
||||
await loadFaces(person.value.identityUuid)
|
||||
await refreshPerson()
|
||||
} catch (e) { console.error('Bind failed:', e) }
|
||||
}
|
||||
|
||||
async function confirmMerge() {
|
||||
if (!person.value || !mergeTarget.value) return
|
||||
try {
|
||||
await invoke('merge_identities', { uuid: person.value.identityUuid, intoUuid: mergeTarget.value })
|
||||
router.back()
|
||||
} catch (e) { console.error('Merge failed:', e) }
|
||||
function startEditing() {
|
||||
if (!person.value) return
|
||||
editName.value = person.value.name || ''
|
||||
const meta = person.value.metadata || {}
|
||||
editRole.value = meta.role || ''
|
||||
editNotes.value = meta.notes || ''
|
||||
editAliases.value = JSON.parse(JSON.stringify(meta.aliases || []))
|
||||
isEditing.value = true
|
||||
}
|
||||
|
||||
function playVideo(fileUuid: string, start: number, end: number) {
|
||||
currentVideo.value = { fileUuid, startTime: start, endTime: end, title: `${person.value?.name} - ${start.toFixed(1)}s-${end.toFixed(1)}s` }
|
||||
function cancelEditing() {
|
||||
isEditing.value = false
|
||||
}
|
||||
|
||||
async function saveEdit() {
|
||||
if (!person.value || saving.value) return
|
||||
saving.value = true
|
||||
try {
|
||||
const cleanAliases = editAliases.value.filter(a => a.name?.trim()).map(a => ({ name: a.name.trim(), locale: a.locale }))
|
||||
const metadata = {
|
||||
...(person.value.metadata || {}),
|
||||
name: editName.value.trim(),
|
||||
role: editRole.value.trim(),
|
||||
notes: editNotes.value.trim(),
|
||||
starred: person.value.starred,
|
||||
aliases: cleanAliases,
|
||||
}
|
||||
await apiCall('update_identity', {
|
||||
uuid: person.value.identity_uuid,
|
||||
name: editName.value.trim(),
|
||||
metadataJson: JSON.stringify(metadata),
|
||||
})
|
||||
isEditing.value = false
|
||||
invalidatePeople()
|
||||
await refreshPerson()
|
||||
} catch (e) {
|
||||
console.error('Failed to save:', e)
|
||||
} finally {
|
||||
saving.value = false
|
||||
}
|
||||
}
|
||||
|
||||
function addAlias() {
|
||||
const name = aliasName.value.trim()
|
||||
if (!name) return
|
||||
editAliases.value.push({ name, locale: aliasLocale.value })
|
||||
aliasName.value = ''
|
||||
}
|
||||
|
||||
function removeAlias(index: number) {
|
||||
editAliases.value.splice(index, 1)
|
||||
}
|
||||
|
||||
async function handleAvatarUpload(event: Event) {
|
||||
const target = event.target as HTMLInputElement
|
||||
const file = target.files?.[0]
|
||||
if (!file || !person.value) return
|
||||
avatarUploading.value = true
|
||||
try {
|
||||
if (isTauri) {
|
||||
const path = (file as any).path || file.name
|
||||
await (window as any).__TAURI__.invoke('upload_profile_image', {
|
||||
uuid: person.value.identity_uuid,
|
||||
filePath: path,
|
||||
})
|
||||
} else {
|
||||
await apiCall('upload_profile_image', {
|
||||
uuid: person.value.identity_uuid,
|
||||
file: file,
|
||||
})
|
||||
}
|
||||
invalidateProfile(person.value.identity_uuid)
|
||||
loadProfile(person.value.identity_uuid)
|
||||
} catch (e) {
|
||||
console.error('Avatar upload failed:', e)
|
||||
} finally {
|
||||
avatarUploading.value = false
|
||||
target.value = ''
|
||||
}
|
||||
}
|
||||
|
||||
function triggerAvatarUpload() {
|
||||
fileInput.value?.click()
|
||||
}
|
||||
|
||||
async function unbindFace(f: any) {
|
||||
if (!person.value) return
|
||||
const uuid = person.value.identity_uuid
|
||||
if (!confirm('解綁此人臉?')) return
|
||||
try {
|
||||
await apiCall('unbind_face', {
|
||||
uuid,
|
||||
faceId: f.face_id || f.faceId || null,
|
||||
faceRowId: f.id || null,
|
||||
fileUuid: f.file_uuid || f.fileUuid || '',
|
||||
frameNumber: f.frame_number ?? f.frameNumber ?? null,
|
||||
})
|
||||
await loadFaces(uuid)
|
||||
invalidatePeople()
|
||||
await ensurePeople()
|
||||
allPeople.value = peopleCache.value
|
||||
const found = allPeople.value.find((p: any) => p.identity_uuid === uuid)
|
||||
if (found) {
|
||||
person.value = { ...found, status: found.status || 'confirmed' }
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('Unbind failed:', e)
|
||||
alert('解綁失敗:' + (e instanceof Error ? e.message : String(e)))
|
||||
}
|
||||
}
|
||||
|
||||
async function updateStatus(status: string) {
|
||||
if (!person.value) return
|
||||
try {
|
||||
await apiCall('update_identity_status', { uuid: person.value.identity_uuid, status })
|
||||
person.value.status = status
|
||||
await refreshPerson()
|
||||
} catch (e) { console.error('Failed to update status:', e) }
|
||||
}
|
||||
|
||||
function playMerged(m: any) {
|
||||
const t = allTraces.value[m._startIdx]
|
||||
if (!t) return
|
||||
currentVideo.value = {
|
||||
fileUuid: t.file_uuid || '',
|
||||
startTime: t.first_sec || t.start_time || 0,
|
||||
endTime: t.last_sec || t.end_time || 0,
|
||||
traceIdx: m._startIdx,
|
||||
title: `${person.value?.name} · #${m.start_frame}–#${m.end_frame}`,
|
||||
}
|
||||
playing.value = true
|
||||
}
|
||||
|
||||
@@ -276,27 +645,87 @@ function formatTime(sec: number): string {
|
||||
const m = Math.floor(sec / 60); const s = Math.floor(sec % 60)
|
||||
return `${m}:${s.toString().padStart(2, '0')}`
|
||||
}
|
||||
|
||||
async function refreshPerson() {
|
||||
invalidatePeople()
|
||||
await ensurePeople()
|
||||
allPeople.value = peopleCache.value
|
||||
const uuid = person.value?.identity_uuid || (route.params.uuid as string)
|
||||
const found = allPeople.value.find((p: any) => p.identity_uuid === uuid)
|
||||
if (found) {
|
||||
person.value = { ...found, status: found.status || 'confirmed' }
|
||||
}
|
||||
}
|
||||
|
||||
async function onMergeSearch() {
|
||||
clearTimeout(mergeSearchTimer)
|
||||
if (!mergeSearchQuery.value.trim()) { mergeSearchResults.value = []; return }
|
||||
mergeSearchTimer = setTimeout(() => {
|
||||
const q = mergeSearchQuery.value.toLowerCase()
|
||||
mergeSearchResults.value = allPeople.value
|
||||
.filter((p: any) => p.identity_uuid !== person.value?.identity_uuid && p.name.toLowerCase().includes(q))
|
||||
.slice(0, 20)
|
||||
}, 200)
|
||||
}
|
||||
|
||||
async function confirmMergeTarget(target: any) {
|
||||
if (!person.value) return
|
||||
if (!confirm(`合併「${person.value.name}」到「${target.name}」?`)) return
|
||||
try {
|
||||
await apiCall('merge_identities', { uuid: person.value.identity_uuid, intoUuid: target.identity_uuid })
|
||||
showMerge.value = false
|
||||
router.back()
|
||||
} catch (e) { console.error('Merge failed:', e) }
|
||||
}
|
||||
|
||||
let mergeSearchTimer: any
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
.people-view { max-width: 1200px; padding-top: 20px; }
|
||||
.ms-ppl-topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; margin-top: 20px; }
|
||||
.ms-ppl-edit-text-btn { border: none; background: transparent; font-family: 'DM Sans', 'Noto Sans TC', sans-serif; font-size: 13px; color: #5f6368; cursor: pointer; outline: none; padding: 4px 10px; display: flex; align-items: center; gap: 4px; transition: color .15s; }
|
||||
.ms-ppl-edit-text-btn:hover { color: #202124; }
|
||||
.loading-state, .empty { text-align: center; padding: 60px 0; color: #5f6368; }
|
||||
.spinner-lg { width: 24px; height: 24px; border: 3px solid #e8eaed; border-top-color: #202124; border-radius: 50%; animation: spin 0.7s linear infinite; margin: 0 auto 12px; }
|
||||
@keyframes spin { to { transform: rotate(360deg); } }
|
||||
.close-btn { position: absolute; top: 16px; right: 16px; }
|
||||
.ms-ppl-detail-header { display: flex; align-items: flex-start; gap: 22px; margin-bottom: 28px; position: relative; margin-top: 20px; }
|
||||
.ms-ppl-detail-avatar { width: 120px; height: 120px; border-radius: 20px; background: #e0e0e0; flex-shrink: 0; overflow: hidden; }
|
||||
.ms-ppl-detail-avatar { width: 120px; height: 120px; border-radius: 20px; background: #e0e0e0; flex-shrink: 0; overflow: hidden; position: relative; }
|
||||
.ms-ppl-detail-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 20px; }
|
||||
.ms-ppl-avatar-editable { cursor: pointer; }
|
||||
.ms-ppl-avatar-upload-hint { position: absolute; inset: 0; border-radius: 20px; background: rgba(0,0,0,.45); display: flex; align-items: center; justify-content: center; opacity: 0; transition: opacity .15s; pointer-events: none; }
|
||||
.ms-ppl-avatar-editable:hover .ms-ppl-avatar-upload-hint { opacity: 1; }
|
||||
.ms-ppl-avatar-upload-hint svg { color: #fff; }
|
||||
.ms-silhouette { width: 100%; height: 100%; }
|
||||
.ms-ppl-detail-name-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
|
||||
.ms-ppl-star-btn { font-size: 20px; background: transparent; border: none; cursor: pointer; outline: none; line-height: 1; color: #d1d5db; transition: color .15s; padding: 0; flex-shrink: 0; }
|
||||
.ms-ppl-star-btn.starred { color: #f59e0b; }
|
||||
.ms-ppl-detail-aliases { display: flex; flex-wrap: wrap; gap: 5px; margin-bottom: 12px; }
|
||||
.ms-ppl-alias-chip { display: inline-flex; align-items: center; background: #f0f0f0; border-radius: 999px; padding: 3px 10px; font-size: 11.5px; color: #5f6368; }
|
||||
.ms-ppl-edit-row { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
|
||||
.ms-ppl-edit-name-row { margin-bottom: 8px; }
|
||||
.ms-ppl-edit-alias-row { padding-left: 32px; margin-bottom: 16px; gap: 6px; align-items: center; }
|
||||
.ms-ppl-alias-wrap-inner { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
|
||||
.ms-ppl-alias-tag { display: inline-flex; align-items: center; gap: 5px; background: #e8eaed; border-radius: 999px; padding: 4px 10px; font-size: 12.5px; color: #202124; }
|
||||
.ms-ppl-alias-tag button { border: none; background: transparent; cursor: pointer; color: #5f6368; font-size: 14px; line-height: 1; padding: 0; display: flex; align-items: center; }
|
||||
.ms-ppl-alias-add-btn { border: 1.5px dashed #bbb; background: transparent; border-radius: 999px; padding: 4px 10px; font-size: 12px; color: #5f6368; cursor: pointer; outline: none; }
|
||||
.ms-ppl-alias-add-btn:hover { border-color: #202124; color: #202124; }
|
||||
.ms-ppl-alias-inline-wrap { display: flex; align-items: center; }
|
||||
.ms-ppl-alias-inline-input { border: 1.5px solid #1a56db; border-radius: 999px; padding: 4px 12px; font-family: 'DM Sans', 'Noto Sans TC', sans-serif; font-size: 12.5px; color: #202124; outline: none; background: #fff; min-width: 140px; transition: border-color .15s; }
|
||||
.ms-ppl-alias-inline-input:focus { border-color: #1a56db; }
|
||||
.ms-ppl-alias-locale-select { border: 1.5px solid #1a56db; border-radius: 999px; padding: 4px 10px; font-family: 'DM Sans', 'Noto Sans TC', sans-serif; font-size: 12px; color: #202124; background: #fff; outline: none; cursor: pointer; height: 30px; }
|
||||
.ms-ppl-edit-fields { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
|
||||
.ms-ppl-edit-field-row { display: flex; align-items: center; gap: 12px; }
|
||||
.ms-ppl-edit-field-row--top { align-items: flex-start; }
|
||||
.ms-ppl-edit-label { font-family: 'DM Sans', 'Noto Sans TC', sans-serif; font-size: 12px; font-weight: 700; color: #202124; letter-spacing: .03em; min-width: 30px; text-align: right; flex-shrink: 0; padding-top: 2px; }
|
||||
.ms-ppl-edit-input { border: 1.5px solid #e8eaed; border-radius: 12px; padding: 9px 14px; font-family: 'DM Sans', 'Noto Sans TC', sans-serif; font-size: 13.5px; color: #202124; outline: none; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.06); transition: border-color .15s, box-shadow .15s; min-width: 0; box-sizing: border-box; width: 100%; }
|
||||
.ms-ppl-edit-input:focus { border-color: #1a56db; box-shadow: 0 0 0 3px rgba(26,86,219,.1); }
|
||||
.ms-ppl-edit-name-input { font-size: 16px !important; font-weight: 700 !important; flex: 1; min-width: 160px; }
|
||||
.ms-ppl-edit-textarea { width: 100%; border: 1.5px solid #e8eaed; border-radius: 12px; padding: 9px 14px; font-family: 'DM Sans', 'Noto Sans TC', sans-serif; font-size: 13px; color: #202124; outline: none; resize: vertical; min-height: 72px; background: #fff; box-shadow: 0 1px 4px rgba(0,0,0,.06); transition: border-color .15s, box-shadow .15s; box-sizing: border-box; }
|
||||
.ms-ppl-edit-textarea:focus { border-color: #1a56db; box-shadow: 0 0 0 3px rgba(26,86,219,.1); }
|
||||
.ms-ppl-edit-actions { display: flex; gap: 8px; padding-left: 42px; }
|
||||
.ms-ppl-edit-field-input { flex: 1; min-width: 0; }
|
||||
.ms-ppl-view-box { font-family: 'DM Sans', 'Noto Sans TC', sans-serif; font-size: 13.5px; color: #202124; min-height: 24px; display: flex; align-items: center; word-break: break-word; padding: 2px 0; }
|
||||
.ms-ppl-view-name-box { font-size: 20px; font-weight: 700; flex: 1; min-width: 0; }
|
||||
.ms-ppl-view-field-box { flex: 1; min-width: 0; color: #3c4043; }
|
||||
@@ -306,17 +735,27 @@ function formatTime(sec: number): string {
|
||||
.ms-ppl-strip-add-btn:hover { border-color: #202124; color: #202124; }
|
||||
.ms-ppl-face-strip { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; scrollbar-width: thin; flex: 1; }
|
||||
.ms-ppl-strip-face { position: relative; flex-shrink: 0; cursor: pointer; }
|
||||
.ms-ppl-strip-face-clickable.selected { outline: 2px solid #1a56db; outline-offset: 2px; border-radius: 14px; }
|
||||
.ms-ppl-strip-face-img { width: 52px; height: 52px; border-radius: 12px; border: 2px solid transparent; background: #e8eaed; overflow: hidden; transition: border-color .15s; }
|
||||
.ms-ppl-strip-face:hover .ms-ppl-strip-face-img { border-color: #202124; }
|
||||
.ms-ppl-face-card-detail { display: flex; gap: 16px; align-items: flex-start; background: #fff; border: 1px solid #e0e0e0; border-radius: 16px; padding: 16px; margin: 12px 0; position: relative; box-shadow: 0 4px 16px rgba(0,0,0,.08); }
|
||||
.ms-ppl-face-card-close { position: absolute; top: 8px; right: 10px; background: none; border: none; font-size: 20px; cursor: pointer; color: #9aa0a6; line-height: 1; padding: 2px 6px; border-radius: 6px; }
|
||||
.ms-ppl-face-card-close:hover { background: #f3f4f6; color: #202124; }
|
||||
.ms-ppl-face-card-img-wrap { width: 120px; height: 120px; border-radius: 12px; overflow: hidden; flex-shrink: 0; background: #e8eaed; }
|
||||
.ms-ppl-face-card-info { flex: 1; min-width: 0; }
|
||||
.ms-ppl-face-card-file { font-size: 13px; color: #5f6368; font-family: monospace; }
|
||||
.ms-ppl-face-card-frame { font-size: 13px; color: #3c4043; margin-top: 2px; }
|
||||
.ms-ppl-face-card-conf { font-size: 12px; color: #9aa0a6; margin-top: 2px; }
|
||||
.ms-ppl-face-card-actions { display: flex; gap: 8px; margin-top: 10px; }
|
||||
.ms-ppl-strip-arrow { width: 28px; height: 28px; border-radius: 50%; border: 1.5px solid #d1d5db; background: #fff; font-size: 18px; display: grid; place-items: center; cursor: pointer; color: #5f6368; outline: none; flex-shrink: 0; transition: background .15s; }
|
||||
.ms-ppl-strip-arrow:hover { background: #f3f4f6; color: #202124; }
|
||||
.ms-ppl-media-label { font-size: 13px; color: #5f6368; margin-bottom: 16px; }
|
||||
.ms-ppl-media-item { cursor: pointer; border-radius: 12px; overflow: visible; background: #f0f0f0; transition: transform .15s, box-shadow .15s; border: 1px solid #eee; }
|
||||
.ms-ppl-media-item:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.1); }
|
||||
.ms-ppl-media-thumb { position: relative; width: 100%; aspect-ratio: 16/9; overflow: hidden; background: #e8eaed; border-radius: 12px 12px 0 0; }
|
||||
.ms-thumb-play-circle { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.18); border-radius: 12px 12px 0 0; }
|
||||
.ms-thumb-play-circle svg { width: 38px; height: 38px; opacity: .7; transition: opacity .15s, transform .15s; }
|
||||
.ms-ppl-media-item:hover .ms-thumb-play-circle svg { opacity: 1; transform: scale(1.08); }
|
||||
.ms-ppl-thumb-play-circle { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.18); border-radius: 12px 12px 0 0; }
|
||||
.ms-ppl-thumb-play-circle svg { width: 38px; height: 38px; opacity: .7; transition: opacity .15s, transform .15s; }
|
||||
.ms-ppl-media-item:hover .ms-ppl-thumb-play-circle svg { opacity: 1; transform: scale(1.08); }
|
||||
.ms-ppl-media-dur { position: absolute; bottom: 5px; right: 7px; background: rgba(0,0,0,.5); color: #fff; font-size: 10px; padding: 1px 5px; border-radius: 3px; }
|
||||
.ms-ppl-media-info { padding: 8px 10px 10px; background: #fff; }
|
||||
.ms-ppl-media-title { font-size: 12px; font-weight: 600; color: #202124; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-bottom: 2px; }
|
||||
@@ -326,10 +765,22 @@ function formatTime(sec: number): string {
|
||||
.ms-ppl-delete-zone-btn { color: #d93025; border-color: #fecaca; background: #fff; }
|
||||
.ms-ppl-delete-zone-btn:hover { background: #fef2f2; border-color: #d93025; }
|
||||
.face-placeholder { font-size: 0.6rem; color: #5f6368; }
|
||||
.merge-input { width: 100%; padding: 10px 14px; border: 1.5px solid #d1d5db; border-radius: 10px; margin-bottom: 16px; font-size: 0.9rem; outline: none; }
|
||||
.merge-input:focus { border-color: #202124; }
|
||||
.ms-modal-actions { display: flex; justify-content: flex-end; }
|
||||
h2 { margin: 0 0 16px; font-size: 1rem; }
|
||||
.ms-merge-grid { display: flex; flex-wrap: wrap; gap: 16px; max-height: 50vh; overflow-y: auto; }
|
||||
.ms-silhouette { width: 100%; height: 100%; }
|
||||
</style>
|
||||
.ms-ppl-actions-section { display: flex; flex-direction: column; gap: 8px; }
|
||||
.ms-ppl-actions-status { display: flex; align-items: center; gap: 10px; padding: 12px; background: #f8f9fa; border-radius: 10px; font-size: 13px; }
|
||||
.ms-ppl-actions-label { color: #5f6368; font-weight: 500; }
|
||||
.ms-ppl-actions-value { color: #202124; font-weight: 600; text-transform: capitalize; }
|
||||
.ms-ppl-media-badge-conf { position: absolute; top: 5px; left: 7px; background: rgba(0,0,0,.5); color: #fff; font-size: 10px; padding: 1px 5px; border-radius: 3px; }
|
||||
.segment-card { max-width: 320px; margin-bottom: 20px; }
|
||||
|
||||
/* Context menu */
|
||||
.ms-ctx-menu { position: fixed; z-index: 99999; background: #fff; border-radius: 12px; box-shadow: 0 8px 30px rgba(0,0,0,.15); padding: 6px; min-width: 140px; font-size: 13px; color: #222; }
|
||||
.ms-ctx-item { display: flex; align-items: center; gap: 8px; padding: 8px 12px; cursor: pointer; border-radius: 8px; border: none; background: transparent; width: 100%; text-align: left; font-size: 13px; color: #222; font-family: inherit; }
|
||||
.ms-ctx-item:hover { background: #f3f4f6; }
|
||||
.ms-ctx-item.ms-ctx-danger { color: #d93025; }
|
||||
.ms-ctx-item.ms-ctx-danger:hover { background: #fce8e6; }
|
||||
.ms-ctx-item-disabled { padding: 8px 12px; font-size: 12px; color: #9aa0a6; cursor: default; }
|
||||
|
||||
/* Remove button for face strip */
|
||||
.ms-ppl-strip-remove-btn { display: none; position: absolute; top: -6px; right: -6px; width: 18px; height: 18px; border-radius: 50%; background: #fff; border: 1.5px solid #d1d5db; font-size: 11px; color: #5f6368; line-height: 1; cursor: pointer; outline: none; place-items: center; }
|
||||
.ms-ppl-edit-mode .ms-ppl-strip-remove-btn { display: grid; }
|
||||
</style>
|
||||
Reference in New Issue
Block a user