Skip to content

Edge-Drop is a clipboard shelf on the edge of your screen. Hover to open it. Drag files and images into any app, click to copy text and links. Free and open-source for Windows.

feat(onboarding): right-click note and search steps, smooth autoplay handoffs

Deepender25081bfac3ebcd
diff --git a/src/Onboarding.tsx b/src/Onboarding.tsx
index 33e2cfb..ec1b9d6 100644
--- a/src/Onboarding.tsx
+++ b/src/Onboarding.tsx
@@ -71,6 +71,8 @@ export function Onboarding() {
{ key: 'ungroup', view: 'full', open: true, title: t('onboarding.ungroupTitle'), body: t('onboarding.ungroupDesc') },
{ key: 'merge', view: 'full', open: true, title: t('onboarding.mergeTitle'), body: t('onboarding.mergeDesc') },
{ key: 'preview', view: 'full', open: true, title: t('onboarding.previewTitle'), body: t('onboarding.previewDesc') },
+ { key: 'note', view: 'full', open: true, title: t('onboarding.noteTitle'), body: t('onboarding.noteDesc') },
+ { key: 'search', view: 'full', open: true, title: t('onboarding.searchTitle'), body: t('onboarding.searchDesc') },
{ key: 'settings', view: 'frame', open: false, title: t('onboarding.configTitle'), body: t('onboarding.configDesc') }
]
const last = steps.length - 1
@@ -153,7 +155,9 @@ export function Onboarding() {
const s = steps[i]
const demo = DEMOS[s.key]
if (!demo) return
- run.sleep(delay).then(() => playLooped(run, stage(), s.key, s.open, demo, () => autoplay.current!.played())).catch((e) => { if (e !== STOP) console.error(e) })
+ run.sleep(delay)
+ .then(() => playLooped(run, stage(), s.key, s.open, demo, () => autoplay.current!.played(), () => autoplay.current!.advancing))
+ .catch((e) => { if (e !== STOP) console.error(e) })
}
// The tour's own store: the user's settings (language, motion, accent), the
@@ -181,7 +185,8 @@ export function Onboarding() {
},
items: [],
hydrated: true,
- open: false
+ open: false,
+ demo: true
})
applyReduceMotion(settings.reduceMotion)
if (settings.reduceMotion) setPlaying(false)
@@ -197,6 +202,7 @@ export function Onboarding() {
document.body.style.removeProperty('--ob-shelf-scale')
document.body.style.removeProperty('--ob-shelf-top')
document.body.style.removeProperty('--ob-preview-pan')
+ document.body.style.removeProperty('--ob-menu-scale')
runRef.current?.cancel()
timers.current.forEach(clearTimeout)
}
@@ -290,13 +296,6 @@ export function Onboarding() {
atRef.current = at
goRef.current = go
- // The preview step fades the flyout's last stretch out above the text (see .ob-preview-step).
- useEffect(() => {
- document.body.classList.toggle('ob-preview-step', steps[at].key === 'preview')
- return () => document.body.classList.remove('ob-preview-step')
- // eslint-disable-next-line react-hooks/exhaustive-deps
- }, [at])
-
// Autoplay's clock for a step starts when its text is up: after the intro, then on each step change.
useEffect(() => {
if (intro !== 'done') return
@@ -418,7 +417,25 @@ export function Onboarding() {
<div className="ob-base" />
{/* The screen's taskbar: up whenever the whole laptop is in view (welcome, settings). */}
<div className={`ob-taskbar${cam === 'frame' ? ' is-on' : ''}`}>
- <div className="ob-task-apps"><i className="ob-start" /><i className="ob-search" /><i /><i /><i /></div>
+ <div className="ob-task-apps">
+ {/* Start: the Windows 11 logo, four tiles under one gradient (a vector, crisp at any zoom) */}
+ <svg className="ob-start" width="12" height="12" viewBox="0 0 24 24">
+ <defs>
+ <linearGradient id="ob-start-blue" x1="0" y1="0" x2="24" y2="24" gradientUnits="userSpaceOnUse">
+ <stop offset="0" stopColor="#7dd6ff" />
+ <stop offset="0.5" stopColor="#2f9bff" />
+ <stop offset="1" stopColor="#0b5fd8" />
+ </linearGradient>
+ </defs>
+ <g fill="url(#ob-start-blue)">
+ <rect x="0" y="0" width="11.2" height="11.2" rx="1.2" />
+ <rect x="12.8" y="0" width="11.2" height="11.2" rx="1.2" />
+ <rect x="0" y="12.8" width="11.2" height="11.2" rx="1.2" />
+ <rect x="12.8" y="12.8" width="11.2" height="11.2" rx="1.2" />
+ </g>
+ </svg>
+ <i className="ob-search" /><i /><i /><i />
+ </div>
<div className="ob-task-tray">
<svg width="9" height="7" viewBox="0 0 9 7"><path d="M.5 2.6a5.6 5.6 0 0 1 8 0M2 4.1a3.4 3.4 0 0 1 5 0M3.5 5.6a1.3 1.3 0 0 1 2 0" fill="none" stroke="#fff" strokeWidth=".9" strokeLinecap="round" /></svg>
<svg width="11" height="6" viewBox="0 0 11 6"><rect x=".5" y=".5" width="9" height="5" rx="1.2" fill="none" stroke="#fff" strokeWidth=".8" /><rect x="1.6" y="1.6" width="6" height="2.8" rx=".5" fill="#fff" /><rect x="9.8" y="2" width=".8" height="2" rx=".3" fill="#fff" /></svg>
diff --git a/src/components/CardMenu.tsx b/src/components/CardMenu.tsx
index 975107f..ba6bc26 100644
--- a/src/components/CardMenu.tsx
+++ b/src/components/CardMenu.tsx
@@ -259,7 +259,7 @@ export function CardMenu() {
// hand-over must not close the editor.
let blurTimer: number | undefined
const onBlur = () => {
- if (useStore.getState().cardMenu?.mode !== 'edit') return
+ if (useStore.getState().cardMenu?.mode !== 'edit' || useStore.getState().demo) return
window.clearTimeout(blurTimer)
blurTimer = window.setTimeout(() => {
if (!document.hasFocus() && useStore.getState().cardMenu?.mode === 'edit') dismiss(true)
@@ -558,6 +558,12 @@ function MetaEditor({
// Hold the keyboard while the editor is open (acquired on the menu row's
// pointer-down already; this is a no-op then) and put the caret in.
useEffect(() => {
+ // The onboarding tour plays the editor: the caret goes in, the keyboard is never borrowed.
+ if (useStore.getState().demo) {
+ inputRef.current?.focus({ preventScroll: true })
+ inputRef.current?.select()
+ return
+ }
let alive = true
void acquireKeyboard(EDITOR_FOCUS_OWNER).then(() => {
if (!alive) return
diff --git a/src/components/ShelfSearch.tsx b/src/components/ShelfSearch.tsx
index 4eba126..d9824db 100644
--- a/src/components/ShelfSearch.tsx
+++ b/src/components/ShelfSearch.tsx
@@ -33,7 +33,8 @@ export function ShelfSearch() {
// Engage BEFORE focus can happen: pointer-down always fires, focus may not.
// Idempotent — the focus-event backup below reuses it safely.
const engage = useCallback(() => {
- if (engagedRef.current) return
+ // The onboarding tour types here itself; the keyboard is never borrowed.
+ if (engagedRef.current || useStore.getState().demo) return
engagedRef.current = true
void acquireKeyboard('search').then(() => {
try { inputRef.current?.focus() } catch { /* ignore */ }
diff --git a/src/i18n/translations.ts b/src/i18n/translations.ts
index 4df0797..363b76c 100644
--- a/src/i18n/translations.ts
+++ b/src/i18n/translations.ts
@@ -273,6 +273,10 @@ export interface TranslationKeys {
mergeDesc: string
previewTitle: string
previewDesc: string
+ noteTitle: string
+ noteDesc: string
+ searchTitle: string
+ searchDesc: string
configTitle: string
configDesc: string
skip: string
@@ -852,6 +856,10 @@ export const en: TranslationKeys = {
"mergeDesc": "Drop one card onto another to keep related files and images together in one stack.",
"previewTitle": "Look closer",
"previewDesc": "The preview button opens any card full size: images, every file in a stack, long text. You can drag from the preview too.",
+ "noteTitle": "Right-click for more",
+ "noteDesc": "Right-click any card for everything it can do. Give it a note to remember what it is for.",
+ "searchTitle": "Find it again",
+ "searchDesc": "Type in search to find any card by its text, its file names or its note.",
"configTitle": "Make it yours",
"configDesc": "Choose the edge Edge-Drop lives on. Everything else is in Settings, whenever you want it.",
"skip": "Skip",
@@ -1257,6 +1265,10 @@ export const es: TranslationKeys = {
"mergeDesc": "Suelta una tarjeta sobre otra para reunir archivos e imágenes relacionados en una sola pila.",
"previewTitle": "Míralo de cerca",
"previewDesc": "El botón de vista previa abre cualquier tarjeta a tamaño completo: imágenes, cada archivo de una pila, textos largos. También puedes arrastrar desde la vista previa.",
+ "noteTitle": "Clic derecho para más",
+ "noteDesc": "Haz clic derecho en cualquier tarjeta para ver todo lo que puede hacer. Añádele una nota para recordar para qué es.",
+ "searchTitle": "Encuéntralo de nuevo",
+ "searchDesc": "Escribe en la búsqueda para encontrar cualquier tarjeta por su texto, sus nombres de archivo o su nota.",
"configTitle": "Hazlo tuyo",
"configDesc": "Elige en qué borde vive Edge-Drop. Todo lo demás está en Configuración, cuando lo necesites.",
"skip": "Omitir",
@@ -1662,6 +1674,10 @@ export const fr: TranslationKeys = {
"mergeDesc": "Déposez une carte sur une autre pour réunir fichiers et images associés dans une même pile.",
"previewTitle": "Regardez de plus près",
"previewDesc": "Le bouton d'aperçu affiche n'importe quelle carte en grand : images, chaque fichier d'une pile, textes longs. Vous pouvez aussi glisser depuis l'aperçu.",
+ "noteTitle": "Clic droit pour plus",
+ "noteDesc": "Faites un clic droit sur une carte pour voir tout ce qu'elle permet. Ajoutez-lui une note pour vous rappeler à quoi elle sert.",
+ "searchTitle": "Retrouvez tout",
+ "searchDesc": "Tapez dans la recherche pour retrouver une carte par son texte, ses noms de fichiers ou sa note.",
"configTitle": "À votre image",
"configDesc": "Choisissez le bord où vit Edge-Drop. Tout le reste se trouve dans les Paramètres, quand vous le souhaitez.",
"skip": "Ignorer",
@@ -2067,6 +2083,10 @@ export const de: TranslationKeys = {
"mergeDesc": "Legen Sie eine Karte auf eine andere, um zusammengehörige Dateien und Bilder in einem Stapel zu bündeln.",
"previewTitle": "Genauer hinsehen",
"previewDesc": "Die Vorschau-Schaltfläche öffnet jede Karte in voller Größe: Bilder, jede Datei eines Stapels, lange Texte. Auch aus der Vorschau können Sie ziehen.",
+ "noteTitle": "Rechtsklick für mehr",
+ "noteDesc": "Ein Rechtsklick auf eine Karte zeigt alles, was sie kann. Mit einer Notiz wissen Sie immer, wofür sie ist.",
+ "searchTitle": "Alles wiederfinden",
+ "searchDesc": "Tippen Sie in die Suche, um jede Karte über ihren Text, ihre Dateinamen oder ihre Notiz zu finden.",
"configTitle": "Ganz nach Ihrem Geschmack",
"configDesc": "Wählen Sie den Rand, an dem Edge-Drop wohnt. Alles andere finden Sie jederzeit in den Einstellungen.",
"skip": "Überspringen",
@@ -2472,6 +2492,10 @@ export const it: TranslationKeys = {
"mergeDesc": "Rilascia una scheda su un'altra per tenere insieme file e immagini correlati in un'unica pila.",
"previewTitle": "Guarda da vicino",
"previewDesc": "Il pulsante di anteprima apre qualsiasi scheda a dimensione piena: immagini, ogni file di una pila, testi lunghi. Puoi trascinare anche dall'anteprima.",
+ "noteTitle": "Clic destro per altro",
+ "noteDesc": "Fai clic destro su una scheda per vedere tutto ciò che può fare. Aggiungi una nota per ricordare a cosa serve.",
+ "searchTitle": "Ritrova tutto",
+ "searchDesc": "Scrivi nella ricerca per trovare qualsiasi scheda dal testo, dai nomi dei file o dalla nota.",
"configTitle": "Rendilo tuo",
"configDesc": "Scegli il bordo su cui vive Edge-Drop. Tutto il resto è in Impostazioni, quando vuoi.",
"skip": "Salta",
@@ -2877,6 +2901,10 @@ export const pt: TranslationKeys = {
"mergeDesc": "Solte um cartão sobre outro para manter arquivos e imagens relacionados juntos em uma pilha.",
"previewTitle": "Veja de perto",
"previewDesc": "O botão de visualização abre qualquer cartão em tamanho real: imagens, cada arquivo de uma pilha, textos longos. Você também pode arrastar a partir da visualização.",
+ "noteTitle": "Clique direito para mais",
+ "noteDesc": "Clique com o botão direito em qualquer cartão para ver tudo o que ele faz. Adicione uma nota para lembrar para que serve.",
+ "searchTitle": "Encontre de novo",
+ "searchDesc": "Digite na busca para encontrar qualquer cartão pelo texto, pelos nomes dos arquivos ou pela nota.",
"configTitle": "Do seu jeito",
"configDesc": "Escolha em qual borda o Edge-Drop fica. Todo o resto está em Configurações, quando você quiser.",
"skip": "Pular",
@@ -3282,6 +3310,10 @@ export const ru: TranslationKeys = {
"mergeDesc": "Перетащите одну карточку на другую, чтобы собрать связанные файлы и изображения в одну стопку.",
"previewTitle": "Рассмотрите поближе",
"previewDesc": "Кнопка предпросмотра открывает любую карточку целиком: изображения, каждый файл в стопке, длинный текст. Перетаскивать можно и из предпросмотра.",
+ "noteTitle": "Больше — по правому клику",
+ "noteDesc": "Щёлкните правой кнопкой по карточке, чтобы увидеть всё, что она умеет. Добавьте заметку, чтобы помнить, для чего она.",
+ "searchTitle": "Всё найдётся",
+ "searchDesc": "Введите запрос в поиск, чтобы найти любую карточку по тексту, именам файлов или заметке.",
"configTitle": "Настройте под себя",
"configDesc": "Выберите край, у которого живёт Edge-Drop. Всё остальное — в Настройках, когда понадобится.",
"skip": "Пропустить",
@@ -3687,6 +3719,10 @@ export const ja: TranslationKeys = {
"mergeDesc": "カードを別のカードにドロップすると、関連するファイルや画像をひとつのスタックにまとめられます。",
"previewTitle": "じっくり見る",
"previewDesc": "プレビューボタンで、どのカードもフルサイズで表示できます。画像、スタック内のすべてのファイル、長いテキストも。プレビューからドラッグすることもできます。",
+ "noteTitle": "右クリックでもっと",
+ "noteDesc": "カードを右クリックすると、できることがすべて表示されます。メモを追加すれば、何のためのものかすぐにわかります。",
+ "searchTitle": "すぐに見つかる",
+ "searchDesc": "検索に入力すると、テキスト、ファイル名、メモからどのカードでも見つけられます。",
"configTitle": "自分好みに",
"configDesc": "Edge-Drop を置く画面端を選びましょう。その他の項目は、いつでも設定から変更できます。",
"skip": "スキップ",
@@ -4092,6 +4128,10 @@ export const ko: TranslationKeys = {
"mergeDesc": "카드를 다른 카드 위에 놓으면 관련된 파일과 이미지를 하나의 스택으로 묶을 수 있습니다.",
"previewTitle": "자세히 보기",
"previewDesc": "미리 보기 버튼을 누르면 어떤 카드든 전체 크기로 열립니다. 이미지, 스택의 모든 파일, 긴 텍스트까지. 미리 보기에서도 드래그할 수 있습니다.",
+ "noteTitle": "오른쪽 클릭으로 더 보기",
+ "noteDesc": "카드를 오른쪽 클릭하면 할 수 있는 모든 작업이 나타납니다. 메모를 추가해 두면 무엇을 위한 것인지 기억할 수 있습니다.",
+ "searchTitle": "다시 찾기",
+ "searchDesc": "검색창에 입력하면 텍스트, 파일 이름, 메모로 어떤 카드든 찾을 수 있습니다.",
"configTitle": "나만의 방식으로",
"configDesc": "Edge-Drop이 자리할 가장자리를 선택하세요. 나머지는 언제든 설정에서 바꿀 수 있습니다.",
"skip": "건너뛰기",
@@ -4497,6 +4537,10 @@ export const zhCN: TranslationKeys = {
"mergeDesc": "将一张卡片拖放到另一张上,即可把相关的文件和图片归入同一个堆栈。",
"previewTitle": "仔细查看",
"previewDesc": "预览按钮可将任意卡片以完整尺寸打开:图片、堆栈中的每个文件、长文本。也可以直接从预览中拖动。",
+ "noteTitle": "右键查看更多",
+ "noteDesc": "右键点击任意卡片,即可查看它能做的一切。添加备注,随时记得它的用途。",
+ "searchTitle": "随时找回",
+ "searchDesc": "在搜索框中输入,即可按文字、文件名或备注找到任何卡片。",
"configTitle": "随心定制",
"configDesc": "选择 Edge-Drop 停靠的屏幕边缘。其他一切都在“设置”中,随时可调。",
"skip": "跳过",
@@ -4902,6 +4946,10 @@ export const zhTW: TranslationKeys = {
"mergeDesc": "將一張卡片拖放到另一張上,即可把相關的檔案和圖片歸入同一個堆疊。",
"previewTitle": "仔細查看",
"previewDesc": "預覽按鈕可將任何卡片以完整尺寸開啟:圖片、堆疊中的每個檔案、長文字。也可以直接從預覽中拖動。",
+ "noteTitle": "按右鍵查看更多",
+ "noteDesc": "在任何卡片上按右鍵,即可查看它能做的一切。新增備註,隨時記得它的用途。",
+ "searchTitle": "隨時找回",
+ "searchDesc": "在搜尋框中輸入,即可依文字、檔名或備註找到任何卡片。",
"configTitle": "隨心自訂",
"configDesc": "選擇 Edge-Drop 停靠的螢幕邊緣。其他一切都在「設定」中,隨時可調。",
"skip": "略過",
@@ -5307,6 +5355,10 @@ export const hi: TranslationKeys = {
"mergeDesc": "संबंधित फ़ाइलों और छवियों को एक स्टैक में रखने के लिए एक कार्ड को दूसरे पर छोड़ें।",
"previewTitle": "क़रीब से देखें",
"previewDesc": "प्रीव्यू बटन किसी भी कार्ड को पूरे आकार में खोलता है: छवियाँ, स्टैक की हर फ़ाइल, लंबा टेक्स्ट। आप प्रीव्यू से भी खींच सकते हैं।",
+ "noteTitle": "और के लिए राइट-क्लिक करें",
+ "noteDesc": "किसी भी कार्ड पर राइट-क्लिक करके देखें कि वह क्या-क्या कर सकता है। नोट जोड़ें, ताकि याद रहे कि वह किस लिए है।",
+ "searchTitle": "फिर से ढूँढें",
+ "searchDesc": "खोज में लिखें और किसी भी कार्ड को उसके टेक्स्ट, फ़ाइल के नाम या नोट से ढूँढें।",
"configTitle": "इसे अपना बनाएँ",
"configDesc": "चुनें कि Edge-Drop किस किनारे पर रहे। बाकी सब सेटिंग्स में है, जब भी आप चाहें।",
"skip": "छोड़ें",
@@ -5712,6 +5764,10 @@ export const ar: TranslationKeys = {
"mergeDesc": "أفلت بطاقة فوق أخرى لتجمع الملفات والصور المترابطة في مكدس واحد.",
"previewTitle": "نظرة أقرب",
"previewDesc": "يفتح زر المعاينة أي بطاقة بالحجم الكامل: الصور، وكل ملف في المكدس، والنصوص الطويلة. ويمكنك السحب من المعاينة أيضاً.",
+ "noteTitle": "انقر بزر الفأرة الأيمن للمزيد",
+ "noteDesc": "انقر بزر الفأرة الأيمن على أي بطاقة لترى كل ما يمكنها فعله. أضف ملاحظة لتتذكر الغرض منها.",
+ "searchTitle": "اعثر عليه مجدداً",
+ "searchDesc": "اكتب في البحث لتجد أي بطاقة من نصها أو أسماء ملفاتها أو ملاحظتها.",
"configTitle": "اجعله على ذوقك",
"configDesc": "اختر الحافة التي يستقر عليها Edge-Drop. وكل ما عدا ذلك تجده في الإعدادات متى شئت.",
"skip": "تخطٍّ",
@@ -6117,6 +6173,10 @@ export const fa: TranslationKeys = {
"mergeDesc": "یه کارت رو بنداز روی یکی دیگه تا فایل‌ها و عکس‌های مرتبط توی یه دسته کنار هم بمونن.",
"previewTitle": "از نزدیک ببین",
"previewDesc": "دکمه پیش‌نمایش هر کارتی رو با اندازه کامل باز می‌کنه: عکس‌ها، تک‌تک فایل‌های یه دسته، متن‌های بلند. از پیش‌نمایش هم می‌تونی بکشی.",
+ "noteTitle": "کلیک راست برای بیشتر",
+ "noteDesc": "روی هر کارتی کلیک راست کن تا همه کارهایی که می‌تونه بکنه رو ببینی. یه یادداشت بهش اضافه کن تا یادت بمونه برای چیه.",
+ "searchTitle": "دوباره پیداش کن",
+ "searchDesc": "توی جست‌وجو بنویس تا هر کارتی رو با متنش، اسم فایل‌هاش یا یادداشتش پیدا کنی.",
"configTitle": "به سلیقه خودت",
"configDesc": "انتخاب کن Edge-Drop کنار کدوم لبه باشه. بقیه چیزها توی تنظیماته، هر وقت خواستی.",
"skip": "ردش کن",
@@ -6522,6 +6582,10 @@ export const bn: TranslationKeys = {
"mergeDesc": "সম্পর্কিত ফাইল ও ছবি একটি স্ট্যাকে রাখতে একটি কার্ড আরেকটির উপর ছেড়ে দিন।",
"previewTitle": "কাছ থেকে দেখুন",
"previewDesc": "প্রিভিউ বোতাম যেকোনো কার্ড পূর্ণ আকারে খোলে: ছবি, স্ট্যাকের প্রতিটি ফাইল, দীর্ঘ টেক্সট। প্রিভিউ থেকেও টেনে আনতে পারেন।",
+ "noteTitle": "আরও দেখতে রাইট-ক্লিক করুন",
+ "noteDesc": "যেকোনো কার্ডে রাইট-ক্লিক করে দেখুন সেটি কী কী করতে পারে। একটি নোট যোগ করুন, যাতে মনে থাকে সেটি কীসের জন্য।",
+ "searchTitle": "আবার খুঁজে নিন",
+ "searchDesc": "অনুসন্ধানে লিখে যেকোনো কার্ড তার টেক্সট, ফাইলের নাম বা নোট দিয়ে খুঁজে নিন।",
"configTitle": "নিজের মতো সাজান",
"configDesc": "Edge-Drop কোন প্রান্তে থাকবে তা বেছে নিন। বাকি সবকিছু সেটিংসে আছে, যখনই চান।",
"skip": "এড়িয়ে যান",
@@ -6927,6 +6991,10 @@ export const tr: TranslationKeys = {
"mergeDesc": "İlgili dosya ve görselleri tek bir yığında toplamak için bir kartı diğerinin üzerine bırakın.",
"previewTitle": "Daha yakından bakın",
"previewDesc": "Önizleme düğmesi her kartı tam boyutta açar: görseller, yığındaki her dosya, uzun metinler. Önizlemeden de sürükleyebilirsiniz.",
+ "noteTitle": "Daha fazlası için sağ tıklayın",
+ "noteDesc": "Bir karta sağ tıklayarak yapabileceği her şeyi görün. Ne için olduğunu hatırlamak için bir not ekleyin.",
+ "searchTitle": "Kolayca bulun",
+ "searchDesc": "Aramaya yazarak herhangi bir kartı metninden, dosya adlarından veya notundan bulun.",
"configTitle": "Size göre ayarlayın",
"configDesc": "Edge-Drop'un duracağı kenarı seçin. Geri kalan her şey, istediğiniz zaman Ayarlar'da.",
"skip": "Atla",
@@ -7332,6 +7400,10 @@ export const vi: TranslationKeys = {
"mergeDesc": "Thả một thẻ lên thẻ khác để gom các tệp và hình ảnh liên quan vào cùng một ngăn xếp.",
"previewTitle": "Xem kỹ hơn",
"previewDesc": "Nút xem trước mở mọi thẻ ở kích thước đầy đủ: hình ảnh, từng tệp trong ngăn xếp, văn bản dài. Bạn cũng có thể kéo từ bản xem trước.",
+ "noteTitle": "Nhấp chuột phải để xem thêm",
+ "noteDesc": "Nhấp chuột phải vào thẻ bất kỳ để xem mọi việc nó có thể làm. Thêm ghi chú để nhớ thẻ đó dùng để làm gì.",
+ "searchTitle": "Tìm lại dễ dàng",
+ "searchDesc": "Gõ vào ô tìm kiếm để tìm bất kỳ thẻ nào theo văn bản, tên tệp hoặc ghi chú của nó.",
"configTitle": "Tùy chỉnh theo ý bạn",
"configDesc": "Chọn mép màn hình cho Edge-Drop. Mọi thứ khác đều nằm trong Cài đặt, bất cứ khi nào bạn cần.",
"skip": "Bỏ qua",
@@ -7737,6 +7809,10 @@ export const pl: TranslationKeys = {
"mergeDesc": "Upuść jedną kartę na drugą, aby trzymać powiązane pliki i obrazy razem w jednym stosie.",
"previewTitle": "Przyjrzyj się bliżej",
"previewDesc": "Przycisk podglądu otwiera każdą kartę w pełnym rozmiarze: obrazy, każdy plik ze stosu, długie teksty. Z podglądu też możesz przeciągać.",
+ "noteTitle": "Więcej pod prawym przyciskiem",
+ "noteDesc": "Kliknij kartę prawym przyciskiem, aby zobaczyć wszystko, co potrafi. Dodaj notatkę, aby pamiętać, do czego służy.",
+ "searchTitle": "Znajdź to ponownie",
+ "searchDesc": "Wpisz w wyszukiwarkę, aby znaleźć dowolną kartę po tekście, nazwach plików lub notatce.",
"configTitle": "Dopasuj do siebie",
"configDesc": "Wybierz krawędź, przy której mieszka Edge-Drop. Wszystko inne znajdziesz w Ustawieniach, kiedy tylko zechcesz.",
"skip": "Pomiń",
@@ -8142,6 +8218,10 @@ export const nl: TranslationKeys = {
"mergeDesc": "Zet een kaart op een andere neer om bij elkaar horende bestanden en afbeeldingen samen in één stapel te houden.",
"previewTitle": "Kijk van dichtbij",
"previewDesc": "De voorbeeldknop opent elke kaart op volledige grootte: afbeeldingen, elk bestand in een stapel, lange tekst. Je kunt ook vanuit het voorbeeld slepen.",
+ "noteTitle": "Rechtsklik voor meer",
+ "noteDesc": "Klik met rechts op een kaart om alles te zien wat hij kan. Voeg een notitie toe om te onthouden waarvoor hij is.",
+ "searchTitle": "Alles terugvinden",
+ "searchDesc": "Typ in het zoekveld om elke kaart te vinden op tekst, bestandsnamen of notitie.",
"configTitle": "Maak het van jou",
"configDesc": "Kies de rand waar Edge-Drop woont. Al het andere vind je in Instellingen, wanneer je maar wilt.",
"skip": "Overslaan",
@@ -8547,6 +8627,10 @@ export const sv: TranslationKeys = {
"mergeDesc": "Släpp ett kort på ett annat för att samla relaterade filer och bilder i en stack.",
"previewTitle": "Titta närmare",
"previewDesc": "Förhandsgranskningsknappen öppnar valfritt kort i full storlek: bilder, varje fil i en stack, lång text. Du kan dra från förhandsgranskningen också.",
+ "noteTitle": "Högerklicka för mer",
+ "noteDesc": "Högerklicka på ett kort för att se allt det kan göra. Lägg till en anteckning så att du minns vad det är till för.",
+ "searchTitle": "Hitta igen",
+ "searchDesc": "Skriv i sökfältet för att hitta valfritt kort via dess text, filnamn eller anteckning.",
"configTitle": "Gör den till din",
"configDesc": "Välj vilken kant Edge-Drop bor på. Allt annat finns i Inställningar, när du vill.",
"skip": "Hoppa över",
@@ -8952,6 +9036,10 @@ export const id: TranslationKeys = {
"mergeDesc": "Lepaskan satu kartu ke kartu lain untuk menyatukan berkas dan gambar terkait dalam satu tumpukan.",
"previewTitle": "Lihat lebih dekat",
"previewDesc": "Tombol pratinjau membuka kartu apa pun dalam ukuran penuh: gambar, setiap berkas dalam tumpukan, teks panjang. Anda juga bisa menyeret dari pratinjau.",
+ "noteTitle": "Klik kanan untuk lainnya",
+ "noteDesc": "Klik kanan kartu mana pun untuk melihat semua yang bisa dilakukannya. Tambahkan catatan agar Anda ingat untuk apa kartu itu.",
+ "searchTitle": "Temukan kembali",
+ "searchDesc": "Ketik di pencarian untuk menemukan kartu apa pun lewat teks, nama berkas, atau catatannya.",
"configTitle": "Sesuaikan dengan Anda",
"configDesc": "Pilih tepi tempat Edge-Drop berada. Semua yang lain ada di Pengaturan, kapan pun Anda mau.",
"skip": "Lewati",
@@ -9357,6 +9445,10 @@ export const uk: TranslationKeys = {
"mergeDesc": "Перетягніть одну картку на іншу, щоб зібрати пов'язані файли й зображення в один стек.",
"previewTitle": "Роздивіться ближче",
"previewDesc": "Кнопка попереднього перегляду відкриває будь-яку картку в повному розмірі: зображення, кожен файл у стеку, довгий текст. Перетягувати можна й з перегляду.",
+ "noteTitle": "Більше — правою кнопкою",
+ "noteDesc": "Клацніть картку правою кнопкою, щоб побачити все, що вона вміє. Додайте нотатку, щоб пам'ятати, для чого вона.",
+ "searchTitle": "Усе знайдеться",
+ "searchDesc": "Введіть запит у пошук, щоб знайти будь-яку картку за текстом, назвами файлів або нотаткою.",
"configTitle": "Налаштуйте під себе",
"configDesc": "Виберіть край, біля якого живе Edge-Drop. Усе інше — у Налаштуваннях, коли забажаєте.",
"skip": "Пропустити",
@@ -9762,6 +9854,10 @@ export const el: TranslationKeys = {
"mergeDesc": "Αφήστε μια κάρτα πάνω σε μια άλλη για να κρατήσετε σχετικά αρχεία και εικόνες μαζί σε μία στοίβα.",
"previewTitle": "Δείτε από κοντά",
"previewDesc": "Το κουμπί προεπισκόπησης ανοίγει κάθε κάρτα σε πλήρες μέγεθος: εικόνες, κάθε αρχείο μιας στοίβας, μεγάλα κείμενα. Μπορείτε να σύρετε και από την προεπισκόπηση.",
+ "noteTitle": "Δεξί κλικ για περισσότερα",
+ "noteDesc": "Κάντε δεξί κλικ σε μια κάρτα για να δείτε όλα όσα μπορεί να κάνει. Προσθέστε μια σημείωση για να θυμάστε σε τι χρησιμεύει.",
+ "searchTitle": "Βρείτε το ξανά",
+ "searchDesc": "Πληκτρολογήστε στην αναζήτηση για να βρείτε οποιαδήποτε κάρτα από το κείμενο, τα ονόματα αρχείων ή τη σημείωσή της.",
"configTitle": "Κάντε το δικό σας",
"configDesc": "Επιλέξτε την άκρη όπου θα βρίσκεται το Edge-Drop. Όλα τα υπόλοιπα είναι στις Ρυθμίσεις, όποτε τα χρειαστείτε.",
"skip": "Παράλειψη",
@@ -10167,6 +10263,10 @@ export const cs: TranslationKeys = {
"mergeDesc": "Pusťte jednu kartu na druhou a mějte související soubory a obrázky pohromadě v jednom stohu.",
"previewTitle": "Podívejte se zblízka",
"previewDesc": "Tlačítko náhledu otevře libovolnou kartu v plné velikosti: obrázky, každý soubor ve stohu, dlouhý text. Přetahovat můžete i z náhledu.",
+ "noteTitle": "Více pravým tlačítkem",
+ "noteDesc": "Klikněte na kartu pravým tlačítkem a uvidíte vše, co umí. Přidejte poznámku, abyste věděli, k čemu je.",
+ "searchTitle": "Vše znovu najdete",
+ "searchDesc": "Pište do vyhledávání a najdete jakoukoli kartu podle textu, názvů souborů nebo poznámky.",
"configTitle": "Přizpůsobte si ho",
"configDesc": "Vyberte okraj, u kterého Edge-Drop bydlí. Vše ostatní najdete v Nastavení, kdykoli budete chtít.",
"skip": "Přeskočit",
@@ -10572,6 +10672,10 @@ export const ro: TranslationKeys = {
"mergeDesc": "Plasează un card peste altul ca să păstrezi fișierele și imaginile înrudite împreună, într-o stivă.",
"previewTitle": "Privește mai atent",
"previewDesc": "Butonul de previzualizare deschide orice card la dimensiune completă: imagini, fiecare fișier dintr-o stivă, texte lungi. Poți trage și din previzualizare.",
+ "noteTitle": "Clic dreapta pentru mai mult",
+ "noteDesc": "Dă clic dreapta pe orice card ca să vezi tot ce poate face. Adaugă o notă ca să știi la ce folosește.",
+ "searchTitle": "Găsește-l din nou",
+ "searchDesc": "Scrie în căutare ca să găsești orice card după text, numele fișierelor sau notă.",
"configTitle": "Fă-l al tău",
"configDesc": "Alege marginea pe care stă Edge-Drop. Restul îl găsești în Setări, oricând vrei.",
"skip": "Sari peste",
@@ -10977,6 +11081,10 @@ export const hu: TranslationKeys = {
"mergeDesc": "Ejtsen egy kártyát egy másikra, hogy az összetartozó fájlok és képek egy kötegben maradjanak.",
"previewTitle": "Nézze meg közelebbről",
"previewDesc": "Az előnézet gomb bármely kártyát teljes méretben megnyit: képeket, egy köteg minden fájlját, hosszú szöveget. Az előnézetből is húzhat.",
+ "noteTitle": "Jobb kattintás a továbbiakért",
+ "noteDesc": "Kattintson jobb gombbal egy kártyára, és lássa, mi mindenre képes. Adjon hozzá jegyzetet, hogy tudja, mire való.",
+ "searchTitle": "Találja meg újra",
+ "searchDesc": "Írjon a keresőbe, és bármely kártyát megtalál a szövege, a fájlnevei vagy a jegyzete alapján.",
"configTitle": "Szabja személyre",
"configDesc": "Válassza ki, melyik szélen legyen az Edge-Drop. Minden mást a Beállításokban talál, amikor csak szeretné.",
"skip": "Kihagyás",
@@ -11382,6 +11490,10 @@ export const da: TranslationKeys = {
"mergeDesc": "Slip ét kort oven på et andet for at holde relaterede filer og billeder samlet i én stak.",
"previewTitle": "Se nærmere",
"previewDesc": "Knappen til forhåndsvisning åbner ethvert kort i fuld størrelse: billeder, hver fil i en stak, lang tekst. Du kan også trække fra forhåndsvisningen.",
+ "noteTitle": "Højreklik for mere",
+ "noteDesc": "Højreklik på et kort for at se alt, hvad det kan. Tilføj en note, så du husker, hvad det er til.",
+ "searchTitle": "Find det igen",
+ "searchDesc": "Skriv i søgningen for at finde ethvert kort ud fra dets tekst, filnavne eller note.",
"configTitle": "Gør det til dit",
"configDesc": "Vælg den kant, Edge-Drop bor på. Alt andet finder du i Indstillinger, når du har lyst.",
"skip": "Spring over",
@@ -11787,6 +11899,10 @@ export const fi: TranslationKeys = {
"mergeDesc": "Pudota kortti toisen päälle, niin toisiinsa liittyvät tiedostot ja kuvat pysyvät yhdessä pinossa.",
"previewTitle": "Katso tarkemmin",
"previewDesc": "Esikatselupainike avaa minkä tahansa kortin täysikokoisena: kuvat, pinon jokaisen tiedoston, pitkät tekstit. Voit vetää myös esikatselusta.",
+ "noteTitle": "Lisää hiiren oikealla",
+ "noteDesc": "Napsauta korttia hiiren oikealla painikkeella nähdäksesi kaiken, mitä se osaa. Lisää muistiinpano, niin muistat, mihin se on tarkoitettu.",
+ "searchTitle": "Löydä uudelleen",
+ "searchDesc": "Kirjoita hakuun ja löydä mikä tahansa kortti sen tekstin, tiedostonimien tai muistiinpanon perusteella.",
"configTitle": "Tee siitä omasi",
"configDesc": "Valitse reuna, jolla Edge-Drop asuu. Kaikki muu löytyy Asetuksista, aina kun haluat.",
"skip": "Ohita",
@@ -12192,6 +12308,10 @@ export const th: TranslationKeys = {
"mergeDesc": "วางการ์ดหนึ่งลงบนอีกใบ เพื่อเก็บไฟล์และรูปภาพที่เกี่ยวข้องไว้ด้วยกันในสแต็กเดียว",
"previewTitle": "ดูใกล้ ๆ",
"previewDesc": "ปุ่มพรีวิวเปิดการ์ดใดก็ได้แบบเต็มขนาด ทั้งรูปภาพ ทุกไฟล์ในสแต็ก และข้อความยาว ๆ คุณยังลากจากพรีวิวได้ด้วย",
+ "noteTitle": "คลิกขวาเพื่อดูเพิ่มเติม",
+ "noteDesc": "คลิกขวาที่การ์ดใดก็ได้เพื่อดูทุกอย่างที่ทำได้ เพิ่มโน้ตไว้เพื่อจำว่าการ์ดนั้นมีไว้ทำอะไร",
+ "searchTitle": "หาเจอได้อีกครั้ง",
+ "searchDesc": "พิมพ์ในช่องค้นหาเพื่อหาการ์ดใดก็ได้จากข้อความ ชื่อไฟล์ หรือโน้ตของมัน",
"configTitle": "ปรับให้เป็นของคุณ",
"configDesc": "เลือกขอบจอที่ Edge-Drop จะอยู่ ส่วนอื่น ๆ ทั้งหมดอยู่ในการตั้งค่า เมื่อใดก็ได้ที่คุณต้องการ",
"skip": "ข้าม",
@@ -12597,6 +12717,10 @@ export const he: TranslationKeys = {
"mergeDesc": "שחרר כרטיס אחד על אחר כדי לשמור קבצים ותמונות קשורים יחד במחסנית אחת.",
"previewTitle": "הבט מקרוב",
"previewDesc": "כפתור התצוגה המקדימה פותח כל כרטיס בגודל מלא: תמונות, כל קובץ במחסנית, טקסט ארוך. אפשר לגרור גם מהתצוגה המקדימה.",
+ "noteTitle": "לחיצה ימנית לעוד",
+ "noteDesc": "לחץ לחיצה ימנית על כרטיס כדי לראות את כל מה שהוא יכול לעשות. הוסף הערה כדי לזכור למה הוא נועד.",
+ "searchTitle": "מצא שוב",
+ "searchDesc": "הקלד בחיפוש כדי למצוא כל כרטיס לפי הטקסט שלו, שמות הקבצים או ההערה שלו.",
"configTitle": "התאם אותו לעצמך",
"configDesc": "בחר באיזה קצה Edge-Drop יגור. כל השאר נמצא בהגדרות, מתי שתרצה.",
"skip": "דלג",
@@ -13002,6 +13126,10 @@ export const no: TranslationKeys = {
"mergeDesc": "Slipp ett kort oppå et annet for å holde relaterte filer og bilder samlet i én stabel.",
"previewTitle": "Se nærmere",
"previewDesc": "Forhåndsvisningsknappen åpner ethvert kort i full størrelse: bilder, hver fil i en stabel, lang tekst. Du kan også dra fra forhåndsvisningen.",
+ "noteTitle": "Høyreklikk for mer",
+ "noteDesc": "Høyreklikk på et kort for å se alt det kan gjøre. Legg til et notat, så husker du hva det er til.",
+ "searchTitle": "Finn det igjen",
+ "searchDesc": "Skriv i søket for å finne et hvilket som helst kort ut fra teksten, filnavnene eller notatet.",
"configTitle": "Gjør det til ditt",
"configDesc": "Velg kanten Edge-Drop bor på. Alt annet finner du i Innstillinger, når du vil.",
"skip": "Hopp over",
diff --git a/src/onboarding/autoplay.ts b/src/onboarding/autoplay.ts
index a5f0820..76dd689 100644
--- a/src/onboarding/autoplay.ts
+++ b/src/onboarding/autoplay.ts
@@ -26,7 +26,9 @@ const DEMO_MS: Record<string, number> = {
drag: 3850,
ungroup: 4900,
merge: 3650,
- preview: 3600
+ preview: 3750,
+ note: 9650,
+ search: 3400
}
/** Han, kana and Hangul: one character carries about a word. */
@@ -64,6 +66,11 @@ export class Autoplay {
return this.on && !this.hidden
}
+ /** Whether the tour is moving on by itself (playing, and the window in view). */
+ get advancing() {
+ return this.running
+ }
+
/** The active dash's fill: a new element for each step, which starts the step over. */
attach(el: HTMLElement | null) {
if (el === this.fill) return
diff --git a/src/onboarding/demoItems.ts b/src/onboarding/demoItems.ts
index 37e1f25..37a5137 100644
--- a/src/onboarding/demoItems.ts
+++ b/src/onboarding/demoItems.ts
@@ -67,10 +67,18 @@ export function demoImage(at: number): ClipboardItemDto {
}
}
-export function demoPdf(at: number): ClipboardItemDto {
- return files('demo-pdf', [['Itinerary.pdf', 412_000]], at)
+export function demoPdf(at: number, note?: string): ClipboardItemDto {
+ const it = files('demo-pdf', [['Itinerary.pdf', 412_000]], at)
+ return note ? { ...it, note } : it
}
+/**
+ * The note the tour adds to the itinerary from its right-click menu, and what it then types in search to
+ * find it: a word only the note has, so the shelf narrows to that card as it is typed.
+ */
+export const DEMO_NOTE = 'Train tickets, Friday 6 pm'
+export const DEMO_QUERY = 'train'
+
/**
* Five files of different kinds, selected in File Explorer and copied at once: they arrive as one stack.
* The first is the one pulled out and then combined with the (blue) photo: the slides' orange folder
diff --git a/src/onboarding/lens.ts b/src/onboarding/lens.ts
index b149b2e..03b5527 100644
--- a/src/onboarding/lens.ts
+++ b/src/onboarding/lens.ts
@@ -54,6 +54,7 @@ const moving = (v: View) => (atRest(v) ? 'none' : `translate(${v.x}px, ${v.y}px)
/** Arrived: hold `v` with CSS zoom (the move's translate is in zoomed pixels there, hence / k). */
function hold(lens: HTMLElement, v: View) {
+ lens.classList.remove('is-moving')
lens.style.transition = 'none'
lens.style.zoom = atRest(v) ? '' : String(v.k)
lens.style.transform = atRest(v) ? 'none' : `translate(${v.x / v.k}px, ${v.y / v.k}px)`
@@ -89,6 +90,9 @@ export function zoomTo(lens: HTMLElement, v: View, ms: number, easing = CAM): vo
hold(lens, v)
return
}
+ // while it moves, the cards' pictures stay on their pre-drawn layers (cheap to move; see .ob-shelf in
+ // onboarding.css); once it holds they are drawn again at the size they are shown
+ lens.classList.add('is-moving')
lens.style.transition = `transform ${ms}ms ${easing}`
lens.style.transform = moving(v)
holding.set(lens, window.setTimeout(() => {
diff --git a/src/onboarding/tour.ts b/src/onboarding/tour.ts
index eea3439..581b8d8 100644
--- a/src/onboarding/tour.ts
+++ b/src/onboarding/tour.ts
@@ -12,9 +12,12 @@
* What is not the app itself is drawn here: the pointer, the Ctrl+C keys and
* the other apps (a browser to copy from, File Explorer to drag a file out of,
* a notes app to drop a card into). The drag image is the app's own drag
- * ghost (shared/dragGhost).
+ * ghost (shared/dragGhost). The right-click menu, its note editor and the
+ * search box are the app's own too; the store's `demo` keeps them from
+ * borrowing the keyboard or saving anything to main.
*/
import { useStore } from '../store/appStore'
+import { t } from '../i18n'
import { setEdgeDragPull } from '../lib/edgeDrag'
import type { ClipboardItemDto } from '../../shared/types'
import { dragGhostSvg } from '../../shared/dragGhost'
@@ -22,7 +25,7 @@ import { fileIconUrl, fileKindOf, type FileKind } from '../lib/fileKind'
import { LAPTOP_SCREEN, SHELF_SCALE, TOUR_SCREEN_TOP, toShelfLayer } from './edgeBar'
import { aim, REST, toLocal, toScreen, zoomRest, zoomTo, type Rect, type View } from './lens'
import {
- demoText, demoLink, demoImage, demoPdf, demoStack, demoSingle, demoMerged, STACK_FILES, DEMO_DIR
+ demoText, demoLink, demoImage, demoPdf, demoStack, demoSingle, demoMerged, STACK_FILES, DEMO_DIR, DEMO_NOTE, DEMO_QUERY
} from './demoItems'
export const STOP = Symbol('stop')
@@ -90,6 +93,10 @@ export function itemsFor(step: string, now = Date.now()): ClipboardItemDto[] {
// Dragged out into another app, the image counts as used and moves to the front (as in the app).
const used = [demoImage(now - 500), ...four.filter((it) => it.id !== 'demo-image')]
const split = [demoSingle(now - 2000, STACK_FILES[0]), demoStack(now - 3000, STACK_FILES.slice(1))]
+ // the shelf the preview leaves: the slides and the photo in one stack, the four files in another
+ const kept = (note?: string) => [
+ demoMerged(now - 2000, STACK_FILES[0]), split[1], demoPdf(now - 4000, note), ...three.filter((it) => it.id !== 'demo-image')
+ ]
switch (step) {
case 'welcome': return four
case 'collect': return []
@@ -99,8 +106,11 @@ export function itemsFor(step: string, now = Date.now()): ClipboardItemDto[] {
case 'ungroup': return [used[0], demoStack(now - 1000), ...used.slice(1)]
case 'merge': return [...split, ...used]
case 'preview':
+ case 'note':
+ return kept()
+ case 'search':
case 'settings':
- return [demoMerged(now - 2000, STACK_FILES[0]), split[1], ...four.filter((it) => it.id !== 'demo-image')]
+ return kept(DEMO_NOTE)
default: return []
}
}
@@ -117,9 +127,11 @@ const WINDOW_OF: Record<string, (stage: Stage) => HTMLElement> = {
export function resetDemoState(stage: Stage, next?: string): void {
stage.root.querySelectorAll('.ob-ghost').forEach((el) => el.remove())
stage.root.querySelectorAll('.force-actions').forEach((el) => el.classList.remove('force-actions'))
+ document.querySelectorAll('.ob-cursor-top').forEach((el) => el.remove())
+ leaveField()
set({
internalDragReq: null, dropTargetId: null, expandedStackId: null, previewItemId: null, previewItemRect: null,
- copyFlareActive: false, externalDrag: false, dragActive: false
+ copyFlareActive: false, externalDrag: false, dragActive: false, cardMenu: null, cardMenuRect: null, query: ''
})
setEdgeDragPull(0)
stage.cursor.getAnimations().forEach((a) => a.cancel())
@@ -201,10 +213,21 @@ function clearMarks(stage: Stage) {
class Pointer {
private at = { x: 560, y: 380 }
- constructor(private run: Run, private el: HTMLElement) {}
+ /** `k`: drawn at that scale, for a pointer outside the camera standing in for the one under it. */
+ constructor(private run: Run, readonly el: HTMLElement, private k = 1) {}
private tf(p: { x: number; y: number }, extra = '') {
// The arrow's tip (see .ob-cursor) is the hotspot.
- return `translate(${p.x - 2}px, ${p.y - 2}px) ${extra}`
+ const k = this.k
+ return `translate(${p.x - 2 * k}px, ${p.y - 2 * k}px)${k === 1 ? '' : ` scale(${k})`} ${extra}`
+ }
+ get pos() {
+ return { ...this.at }
+ }
+ /** Shown (or gone) at once, for handing over between the pointer under the camera and its twin above it. */
+ set(x: number, y: number, shown: boolean) {
+ this.at = { x, y }
+ const o = shown ? 1 : 0
+ return this.run.animate(this.el, [{ opacity: o, transform: this.tf(this.at) }, { opacity: o, transform: this.tf(this.at) }], { duration: 1 })
}
show(x: number, y: number) {
this.at = { x, y }
@@ -712,11 +735,123 @@ export async function demoPreview(run: Run, stage: Stage) {
// (a replay or the next step brings it back)
if (document.documentElement.dataset.motion !== 'reduce') {
document.body.classList.add('ob-preview-pan')
- zoomTo(stage.lens, { k: 1, x: 0, y: -PREVIEW_PAN }, 750)
- await run.sleep(800)
+ zoomTo(stage.lens, { k: 1, x: 0, y: -PREVIEW_PAN }, 900)
+ await run.sleep(950)
+ }
+}
+
+/** Types into one of the app's fields the way a keyboard does: its own input events, a character at a time. */
+async function typeInto(run: Run, input: HTMLInputElement, text: string) {
+ const setValue = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value')!.set!
+ for (let i = 1; i <= text.length; i++) {
+ setValue.call(input, text.slice(0, i))
+ input.dispatchEvent(new Event('input', { bubbles: true }))
+ // an even rhythm, a beat longer after a word
+ await run.sleep(text[i - 1] === ' ' ? 150 : 85)
}
}
+/** A field the tour typed in lets go of the caret (on a step change or a replay). */
+function leaveField() {
+ const el = document.activeElement
+ if (el instanceof HTMLInputElement && el.closest('.ob-shelf, .card-menu')) el.blur()
+}
+
+/**
+ * The menu is portaled to <body> like the preview, outside the camera and drawn above the whole scene, so
+ * a twin of the pointer, above it, takes over while it is open (at the scale of the camera's framing `v`).
+ */
+function twinPointer(run: Run, stage: Stage, v: View): Pointer {
+ const el = stage.cursor.cloneNode(true) as HTMLElement
+ el.classList.add('ob-cursor-top')
+ document.body.append(el)
+ return new Pointer(run, el, v.k)
+}
+
+/** A row of the open menu (or a button of the editor) under the twin pointer: hover, then press. */
+async function pick(run: Run, top: Pointer, el: HTMLElement, ms: number) {
+ const r = el.getBoundingClientRect()
+ await top.move(r.left + Math.min(36, r.width * 0.4), r.top + r.height / 2, ms)
+ el.classList.add('is-hover')
+ await run.sleep(220)
+ await top.press()
+}
+
+/**
+ * Right-click a card: the app's own menu opens at the pointer. Add note… turns it into the note editor; a
+ * note is typed and saved, and it shows on the card in place of its file name.
+ */
+export async function demoNote(run: Run, stage: Stage) {
+ const p = new Pointer(run, stage.cursor)
+ await p.show(600, 400)
+ const target = card(stage, 'demo-pdf')
+ const r = rect(stage, target)
+ // the card's upper half, right of its middle: the shelf ends not far to the right, so the menu (which
+ // stays within the shelf's width in the top dock) opens to the pointer's left, and so does the note
+ // editor it turns into, both from the same corner; the card itself stays in view beside them, and both
+ // end well above the step's text
+ const at = { x: r.left + r.width * 0.62, y: r.top + r.height * 0.3 }
+ zoomTo(stage.lens, withEdge(PUSH, at.x), 900)
+ await p.move(at.x, at.y, 900)
+ await run.sleep(80)
+ await p.press()
+ // the menu at the pointer, at the camera's scale (at rest under reduced motion); the twin pointer takes
+ // over above it
+ const v = document.documentElement.dataset.motion === 'reduce' ? REST : withEdge(PUSH, at.x)
+ const s = toScreen(stage.lens, at)
+ document.body.style.setProperty('--ob-menu-scale', String(SHELF_SCALE * v.k))
+ const top = twinPointer(run, stage, v)
+ await Promise.all([top.set(s.x, s.y, true), p.set(at.x, at.y, false)])
+ useStore.getState().openCardMenu('demo-pdf', s.x, s.y)
+ await run.sleep(500)
+ const label = t('menu.addNote')
+ const row = [...document.querySelectorAll<HTMLElement>('.card-menu .card-menu-row')].find((el) => el.textContent === label)
+ if (!row) throw STOP
+ await pick(run, top, row, 520)
+ useStore.getState().editCardMeta()
+ await run.sleep(420)
+ const input = document.querySelector<HTMLInputElement>('.card-menu .card-meta-input')
+ if (!input) throw STOP
+ await typeInto(run, input, DEMO_NOTE)
+ await run.sleep(350)
+ const save = document.querySelector<HTMLElement>('.card-menu .card-meta-btn.is-primary')
+ if (!save) throw STOP
+ await pick(run, top, save, 480)
+ // the editor's own Save: the note goes onto the card (in the tour's store only) and the editor closes
+ save.closest('form')?.requestSubmit()
+ await run.sleep(80)
+ // back under the camera
+ const back = top.pos
+ await Promise.all([p.set((back.x - v.x) / v.k, (back.y - v.y) / v.k, true), top.set(back.x, back.y, false)])
+ top.el.remove()
+ await run.sleep(900)
+ zoomRest(stage.lens, 900)
+ await p.move(600, 400, 900)
+ await p.hide()
+}
+
+/**
+ * Click into the search box and type: the shelf narrows with every letter, down to the card the note
+ * was added to (a word only its note has).
+ */
+export async function demoSearch(run: Run, stage: Stage) {
+ const p = new Pointer(run, stage.cursor)
+ await p.show(600, 400)
+ const input = stage.root.querySelector<HTMLInputElement>('.ob-shelf .search input')
+ if (!input) throw STOP
+ const c = centre(stage, input)
+ zoomTo(stage.lens, SHELF_CLOSE, 900)
+ await p.move(c.x - 40, c.y, 900)
+ await p.press()
+ input.focus({ preventScroll: true })
+ await run.sleep(350)
+ // the pointer moves off the field, out of the way of what is typed
+ p.move(c.x + 70, c.y + 60, 500).catch(() => {})
+ await typeInto(run, input, DEMO_QUERY)
+ await run.sleep(700)
+ await p.hide()
+}
+
export const DEMOS: Record<string, ((run: Run, stage: Stage) => Promise<void>) | undefined> = {
welcome: demoWelcome,
collect: demoCollect,
@@ -725,7 +860,9 @@ export const DEMOS: Record<string, ((run: Run, stage: Stage) => Promise<void>) |
stacks: demoStacks,
ungroup: demoUngroup,
merge: demoMerge,
- preview: demoPreview
+ preview: demoPreview,
+ note: demoNote,
+ search: demoSearch
}
// ---------- replays ----------
@@ -758,11 +895,17 @@ const shelfLayer = (stage: Stage) => stage.root.querySelector<HTMLElement>('.ob-
*/
async function rewind(run: Run, stage: Stage, step: string, open: boolean) {
const st = useStore.getState()
- set({ previewItemId: null, previewItemRect: null, expandedStackId: null })
+ set({ previewItemId: null, previewItemRect: null, expandedStackId: null, cardMenu: null, cardMenuRect: null })
+ // a search empties (the shelf fills back up) and lets go of the caret
+ if (st.query) {
+ leaveField()
+ set({ query: '' })
+ await run.sleep(500)
+ }
// a preview's pan comes back down as the preview closes
if (document.body.classList.contains('ob-preview-pan')) {
document.body.classList.remove('ob-preview-pan')
- zoomRest(stage.lens, 750)
+ zoomRest(stage.lens, 900)
}
for (const m of marks(stage)) {
if (!m.getAnimations().length) continue
@@ -780,7 +923,7 @@ async function rewind(run: Run, stage: Stage, step: string, open: boolean) {
await run.animate(stage.notesImage, [{ opacity: 1 }, { opacity: 0 }], { duration: 400, easing: 'ease' })
}
const start = itemsFor(step)
- const same = start.length === st.items.length && start.every((it, i) => it.id === st.items[i].id)
+ const same = start.length === st.items.length && start.every((it, i) => it.id === st.items[i].id && it.note === st.items[i].note)
if (same) {
await run.sleep(400)
} else if (!open) {
@@ -803,12 +946,24 @@ async function rewind(run: Run, stage: Stage, step: string, open: boolean) {
* A step's demo plays once and rests on its result; after the viewer has been idle a while it rewinds
* gently and plays again, for as long as the step is up. Next moves on at any moment. `played` is told
* each time the demo reaches its end (autoplay times the step on it).
+ *
+ * While autoplay is moving the tour on (`advancing`) the demo does not replay: the step is about to
+ * change, and a replay begun just before it (the camera pushing in, the shelf fading) was cut off half
+ * way by the next step's own moves, a jolt. Paused, it replays as before.
*/
-export async function playLooped(run: Run, stage: Stage, step: string, open: boolean, demo: (run: Run, stage: Stage) => Promise<void>, played?: () => void) {
+export async function playLooped(
+ run: Run, stage: Stage, step: string, open: boolean, demo: (run: Run, stage: Stage) => Promise<void>,
+ played?: () => void, advancing: () => boolean = () => false
+) {
for (;;) {
await demo(run, stage)
if (!run.dead) played?.()
await idleFor(run, REPLAY_IDLE)
+ if (advancing()) {
+ // held until autoplay is paused, then the usual idle wait from there
+ while (advancing()) await run.sleep(200)
+ await idleFor(run, REPLAY_IDLE)
+ }
await rewind(run, stage, step, open)
}
}
diff --git a/src/store/appStore.ts b/src/store/appStore.ts
index 9222901..ed44b02 100644
--- a/src/store/appStore.ts
+++ b/src/store/appStore.ts
@@ -85,6 +85,13 @@ interface AppState {
hydrated: boolean
/** Free-text search filter (UI-only state). */
query: string
+ /**
+ * The onboarding tour's shelf: example items only, played by the tour. Its
+ * note editor and search never borrow the keyboard (that acts on the real
+ * panel window and pauses the global hotkey) and a note stays in this
+ * store, never reaching main.
+ */
+ demo: boolean
typeFilter: import('../../shared/types').TypeFilter
setTypeFilter: (filter: import('../../shared/types').TypeFilter) => void
/** Whether the panel blade is expanded. */
@@ -239,6 +246,7 @@ export const useStore = create<AppState>((set, get) => ({
settings: { ...DEFAULT_SETTINGS },
hydrated: false,
query: '',
+ demo: false,
typeFilter: 'all',
setTypeFilter: (typeFilter) => {
if (get().typeFilter === typeFilter && !get().emojiOpen) return
@@ -732,6 +740,7 @@ export const useStore = create<AppState>((set, get) => ({
return next
})
})
+ if (get().demo) return
try {
const items = await edge.setItemMeta(id, patch)
set({ items })
diff --git a/src/styles/onboarding.css b/src/styles/onboarding.css
index 8ec43fa..0dde51f 100644
--- a/src/styles/onboarding.css
+++ b/src/styles/onboarding.css
@@ -103,14 +103,16 @@
/* The cards' pictures (file icons, the folders and photos of a stack, the grain) are each kept on a
pre-drawn layer in the app, sharp there because the shelf is shown 1:1 (item.css). Here the shelf is
shown scaled (0.72, and the camera zooms it), so those layers were resampled and the glass folders read
- as a milky smear; in the tour they are drawn at the size they are shown. */
-.ob-shelf .single-file-hero svg,
-.ob-shelf .single-file-hero img.file-kind-img,
-.ob-shelf .file-kind-opening > .fko-plain,
-.ob-shelf .fko-layers > .fil,
-.ob-shelf .image-folder-stack-item,
-.ob-shelf .file-stack-folder,
-.ob-shelf .is-textured::before {
+ as a milky smear; in the tour they are drawn at the size they are shown. Except while the camera moves
+ (.is-moving, lens.ts): redrawing the folders' blur and grain filters on every frame of a move dropped
+ frames, so for the move they stay on their layers and are drawn again, sharp, once it holds. */
+.ob-lens:not(.is-moving) .ob-shelf .single-file-hero svg,
+.ob-lens:not(.is-moving) .ob-shelf .single-file-hero img.file-kind-img,
+.ob-lens:not(.is-moving) .ob-shelf .file-kind-opening > .fko-plain,
+.ob-lens:not(.is-moving) .ob-shelf .fko-layers > .fil,
+.ob-lens:not(.is-moving) .ob-shelf .image-folder-stack-item,
+.ob-lens:not(.is-moving) .ob-shelf .file-stack-folder,
+.ob-lens:not(.is-moving) .ob-shelf .is-textured::before {
will-change: auto !important;
}
.ob-shelf .root {
@@ -125,24 +127,54 @@
margin-left: calc(400px * (1 - var(--ob-shelf-scale)) / var(--ob-shelf-scale));
margin-top: calc(var(--ob-shelf-top) / var(--ob-shelf-scale));
}
-/* Preview step: the flyout can reach nearly to the window's bottom (the app's 460px), where the step's
- text is. The text keeps its place, as on every step (top 444); the flyout's last stretch (its file list
+/* The flyout (only the preview step opens it) can reach nearly to the window's bottom (the app's 460px),
+ where the step's text is. The text keeps its place, as on every step (top 444); the flyout's last stretch (its file list
carries on below, as in a scrolled list) fades out just above it instead of running under it: gone by
y 434 even at the flyout's full height. The fade is a gradient sized to 77% of the flyout (nothing shows
past it), so it can give way smoothly: while the camera pans
the screen up (.ob-preview-pan, PREVIEW_PAN in tour.ts) the flyout moves up with it (translate: in its
- own zoomed pixels, hence / scale) and the fade's size grows past the bottom, so all of it is in view. */
-.ob-tour.ob-preview-step > .pf-wrap {
+ own zoomed pixels, hence / scale) and the fade's size grows past the bottom, so all of it is in view.
+ These belong to the flyout itself, not to the step: when the step ends while panned, the flyout glides
+ back down with the camera as it closes, instead of jumping. The pan's 0.9s matches the camera's. */
+.ob-tour > .pf-wrap {
mask-image: linear-gradient(to bottom, #000 86%, transparent);
mask-size: 100% 77%;
mask-repeat: no-repeat;
translate: 0 0;
- transition: mask-size 0.75s cubic-bezier(0.5, 0, 0.25, 1), translate 0.75s cubic-bezier(0.5, 0, 0.25, 1);
+ transition: mask-size 0.9s cubic-bezier(0.5, 0, 0.25, 1), translate 0.9s cubic-bezier(0.5, 0, 0.25, 1);
}
-.ob-tour.ob-preview-step.ob-preview-pan > .pf-wrap {
+.ob-tour.ob-preview-pan > .pf-wrap {
mask-size: 100% 130%;
translate: 0 calc(var(--ob-preview-pan) / var(--ob-shelf-scale));
}
+/* The card's right-click menu (and the note editor it turns into) is portaled to <body> too. It opens at
+ the pointer (in window pixels) and grows from that corner (its inline transform-origin), so it is scaled
+ there to the shelf as the camera shows it: the shelf's scale times the camera's (--ob-menu-scale, set
+ by the tour as it opens it). Inert like the shelf: the tour plays it. */
+.ob-tour > .card-menu {
+ scale: var(--ob-menu-scale, var(--ob-shelf-scale));
+}
+.ob-tour > .card-menu,
+.ob-tour > .card-menu * {
+ pointer-events: none !important;
+}
+/* What the pointer is over (the tour's pointer has no real hover). */
+.ob-tour > .card-menu .card-menu-row.is-hover {
+ background: rgba(255, 255, 255, 0.08);
+ color: var(--text-primary);
+}
+.ob-tour > .card-menu .card-menu-row.is-hover .card-menu-icon {
+ color: #ffffff;
+}
+.ob-tour > .card-menu .card-meta-btn.is-primary.is-hover {
+ background: #e6e6e6;
+}
+/* The pointer's twin above the menu, which is drawn above the whole scene (tour.ts twinPointer). */
+.ob-cursor.ob-cursor-top {
+ position: fixed;
+ z-index: 2147483000;
+ transform-origin: 0 0;
+}
/* Hidden with opacity, not visibility: parts of Panel set visibility inline, which would show through. */
.ob-shelf.is-hidden {
opacity: 0;
@@ -265,11 +297,9 @@
background: rgba(255, 255, 255, 0.22);
}
.ob-task-apps .ob-start {
- background:
- linear-gradient(#5ab2ff, #2f7dff) 0 0 / 5.5px 5.5px no-repeat,
- linear-gradient(#5ab2ff, #2f7dff) 6.5px 0 / 5.5px 5.5px no-repeat,
- linear-gradient(#5ab2ff, #2f7dff) 0 6.5px / 5.5px 5.5px no-repeat,
- linear-gradient(#5ab2ff, #2f7dff) 6.5px 6.5px / 5.5px 5.5px no-repeat;
+ display: block;
+ flex: none;
+ filter: drop-shadow(0 0 2px rgba(80, 170, 255, 0.35));
}
.ob-task-apps .ob-search {
width: 46px;
diff --git a/tests/cardMenu.test.ts b/tests/cardMenu.test.ts
index 19c04f7..2f8dea8 100644
--- a/tests/cardMenu.test.ts
+++ b/tests/cardMenu.test.ts
@@ -267,6 +267,18 @@ describe('store: card menu and note saving', () => {
expect('note' in useStore.getState().items[0]).toBe(false)
})
+ it("the onboarding tour's shelf keeps a note in its own store, never sending it to main", async () => {
+ useStore.setState({ demo: true })
+ try {
+ await useStore.getState().setItemMeta('a', { note: ' Train tickets ' })
+ expect(useStore.getState().items[0].note).toBe('Train tickets')
+ expect(setItemMeta).not.toHaveBeenCalled()
+ expect(useStore.getState().toasts).toHaveLength(0)
+ } finally {
+ useStore.setState({ demo: false })
+ }
+ })
+
it('rolls back and reports when saving fails', async () => {
setItemMeta.mockRejectedValueOnce(new Error('down'))
await useStore.getState().setItemMeta('b', { note: 'X' })