Files
DeepTutor/web/components/workspaces/WorkspaceInstructionsField.tsx
Bingxi Zhao (Frank) 28c11e2ae8 feat: update notes, chat interactions and workspace UI on preview
Remove course pages, APIs and the course_study capability. Add anchored note
threads and reviewed learning-block generation, queued and withdrawable chat
messages, quote attachments, side chats, and the calendar/favorites/navigation
updates.

Keep preview's existing backend architecture. Wire the new features through
its Python application and existing chat engine, retain legacy selected-text
requests, persist mid-turn messages in replay, and restore note context when
regenerating. Leave stored user data intact.

Validate frontend contracts, dependency boundaries, types, 1290 node tests,
840 rendered tests, lint, localization and the production build. Exercise
session/notes/API regressions, 53 chat-engine tests and 20 Python/native
integration tests with isolated runtime data.
2026-10-26 22:13:34 +08:00

60 lines
2.0 KiB
TypeScript

'use client'
import { useId } from 'react'
import { useTranslation } from 'react-i18next'
import { inputClass } from '@/components/settings/shared'
export function WorkspaceInstructionsField({
value,
onChange,
}: {
value: string
onChange: (value: string) => void
}) {
const { t } = useTranslation()
const id = useId()
return (
<div className="space-y-2">
<label htmlFor={id} className="block text-sm font-medium">
{t('Workspace instructions')}
</label>
<p
id={`${id}-description`}
className="text-xs leading-relaxed text-[var(--muted-foreground)]"
>
{t(
'Set learning goals, teaching style and response preferences for this workspace. Leave blank to use the default behavior.'
)}
</p>
<textarea
id={id}
aria-describedby={`${id}-description ${id}-scope`}
className={`${inputClass} min-h-36 resize-y leading-relaxed`}
value={value}
onChange={event => onChange(event.target.value)}
maxLength={10000}
rows={6}
placeholder={t(
'For example: I am learning linear algebra. Explain the geometric intuition before introducing formulas, and give hints before complete solutions.'
)}
/>
<p id={`${id}-scope`} className="text-xs leading-relaxed text-[var(--muted-foreground)]">
{t(
'Applies to Chat, Solve, Ask Questions, Guided Learning, Reading and standard visualizations. Changes take effect on the next turn.'
)}
</p>
<div className="flex items-center justify-between gap-3 text-xs text-[var(--muted-foreground)]">
<button
type="button"
onClick={() => onChange('')}
disabled={!value}
className="underline underline-offset-2 disabled:opacity-50"
>
{t('Clear instructions')}
</button>
<span>{t('{{used}} / {{limit}} characters', { used: value.length, limit: 10000 })}</span>
</div>
</div>
)
}