Move project renaming from the project view to configuration
- ProjectView: title is now a plain <h1>, no longer inline-editable (dropped titleDraft/saveTitle/patchProject and the input markup -- nothing else used patchProject). - ProjectConfigureView: new 'Project name' section above 'Statuses', a small PATCH /api/projects/:id form. On success it also calls the projects store's fetchProjects(), since the dashboard grid and the sidebar's project dropdown read from that store and otherwise wouldn't pick up the new name (or the project's new alphabetical position) until some unrelated reload. - style.css: dropped the now-dead .project-head__title input rules (both views render a plain heading now); .project-head__title gains word-break so a long static title still wraps instead of overflowing. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -28,8 +28,6 @@ const tabs = [
|
||||
] as const
|
||||
const activeTab = ref<(typeof tabs)[number]['key']>('kanban')
|
||||
|
||||
const titleDraft = ref('')
|
||||
|
||||
const newText = ref('')
|
||||
const submitting = ref(false)
|
||||
|
||||
@@ -96,10 +94,6 @@ async function onColumnChange(change: ColumnChange, column: Column) {
|
||||
}
|
||||
}
|
||||
|
||||
watch(project, (value) => {
|
||||
if (value) titleDraft.value = value.title
|
||||
})
|
||||
|
||||
onMounted(() => void load())
|
||||
|
||||
async function load() {
|
||||
@@ -122,31 +116,6 @@ async function load() {
|
||||
}
|
||||
}
|
||||
|
||||
async function patchProject(fields: { title?: string }) {
|
||||
actionError.value = null
|
||||
try {
|
||||
const { project: updated } = await apiRequest<{ project: Project }>(`/projects/${projectId}`, {
|
||||
method: 'PATCH',
|
||||
auth: true,
|
||||
body: fields,
|
||||
})
|
||||
project.value = updated
|
||||
} catch (e) {
|
||||
actionError.value = e instanceof ApiError ? e.message : 'Could not save the change.'
|
||||
if (project.value) titleDraft.value = project.value.title
|
||||
}
|
||||
}
|
||||
|
||||
function saveTitle() {
|
||||
if (!project.value) return
|
||||
const next = titleDraft.value.trim()
|
||||
if (next === '') {
|
||||
titleDraft.value = project.value.title // title is required
|
||||
return
|
||||
}
|
||||
if (next !== project.value.title) void patchProject({ title: next })
|
||||
}
|
||||
|
||||
/** Run a store mutation, surfacing failures and resyncing from the server. */
|
||||
async function run(op: Promise<unknown>) {
|
||||
actionError.value = null
|
||||
@@ -178,16 +147,7 @@ async function onCreate() {
|
||||
|
||||
<template v-else-if="project">
|
||||
<div class="project-head">
|
||||
<h1 class="project-head__title">
|
||||
<input
|
||||
v-model="titleDraft"
|
||||
type="text"
|
||||
maxlength="255"
|
||||
aria-label="Project title"
|
||||
@blur="saveTitle"
|
||||
@keyup.enter="($event.target as HTMLInputElement).blur()"
|
||||
/>
|
||||
</h1>
|
||||
<h1 class="project-head__title">{{ project.title }}</h1>
|
||||
|
||||
<ProjectManageMenu
|
||||
:project-id="projectId"
|
||||
|
||||
Reference in New Issue
Block a user