Simplify the project view header: drop the back link and description
- Remove the '<- All projects' link at the top -- the sidebar's Dashboard link already covers that. - Remove the description textarea and all of its state/save logic (descriptionDraft, saveDescription, patchProject's description field); the backend field and API are untouched. - Drop .project__chrome's 42rem max-width, which existed only to keep the now-gone description prose readable. The header (title + Manage menu) now spans the full wide-layout width, so Manage sits at the true top right instead of a narrower centred column. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -31,7 +31,6 @@ const tabs = [
|
||||
const activeTab = ref<(typeof tabs)[number]['key']>('kanban')
|
||||
|
||||
const titleDraft = ref('')
|
||||
const descriptionDraft = ref('')
|
||||
|
||||
const menuOpen = ref(false)
|
||||
const confirmingDelete = ref(false)
|
||||
@@ -106,10 +105,7 @@ async function onColumnChange(change: ColumnChange, column: Column) {
|
||||
}
|
||||
|
||||
watch(project, (value) => {
|
||||
if (value) {
|
||||
titleDraft.value = value.title
|
||||
descriptionDraft.value = value.description
|
||||
}
|
||||
if (value) titleDraft.value = value.title
|
||||
})
|
||||
|
||||
watch(confirmingDelete, async (open) => {
|
||||
@@ -151,7 +147,7 @@ async function load() {
|
||||
}
|
||||
}
|
||||
|
||||
async function patchProject(fields: { title?: string; description?: string }) {
|
||||
async function patchProject(fields: { title?: string }) {
|
||||
actionError.value = null
|
||||
try {
|
||||
const { project: updated } = await apiRequest<{ project: Project }>(`/projects/${projectId}`, {
|
||||
@@ -162,10 +158,7 @@ async function patchProject(fields: { title?: string; description?: string }) {
|
||||
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
|
||||
descriptionDraft.value = project.value.description
|
||||
}
|
||||
if (project.value) titleDraft.value = project.value.title
|
||||
}
|
||||
}
|
||||
|
||||
@@ -179,12 +172,6 @@ function saveTitle() {
|
||||
if (next !== project.value.title) void patchProject({ title: next })
|
||||
}
|
||||
|
||||
function saveDescription() {
|
||||
if (!project.value) return
|
||||
const next = descriptionDraft.value.trim()
|
||||
if (next !== project.value.description) void patchProject({ description: next })
|
||||
}
|
||||
|
||||
function askDelete() {
|
||||
menuOpen.value = false
|
||||
deleteError.value = null
|
||||
@@ -232,62 +219,48 @@ async function onCreate() {
|
||||
|
||||
<template>
|
||||
<section class="card project">
|
||||
<p><RouterLink to="/">← All projects</RouterLink></p>
|
||||
|
||||
<p v-if="loadError" class="form-error">{{ loadError }}</p>
|
||||
|
||||
<template v-else-if="project">
|
||||
<div class="project__chrome">
|
||||
<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>
|
||||
<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>
|
||||
|
||||
<div class="menu">
|
||||
<button
|
||||
type="button"
|
||||
class="menu__toggle"
|
||||
aria-haspopup="true"
|
||||
:aria-expanded="menuOpen"
|
||||
@click="menuOpen = !menuOpen"
|
||||
>
|
||||
Manage ▾
|
||||
</button>
|
||||
<div class="menu">
|
||||
<button
|
||||
type="button"
|
||||
class="menu__toggle"
|
||||
aria-haspopup="true"
|
||||
:aria-expanded="menuOpen"
|
||||
@click="menuOpen = !menuOpen"
|
||||
>
|
||||
Manage ▾
|
||||
</button>
|
||||
|
||||
<template v-if="menuOpen">
|
||||
<div class="menu__backdrop" @click="menuOpen = false" />
|
||||
<ul class="menu__list" role="menu">
|
||||
<li role="none">
|
||||
<button
|
||||
type="button"
|
||||
role="menuitem"
|
||||
class="menu__item menu__item--danger"
|
||||
@click="askDelete"
|
||||
>
|
||||
Delete project
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
</template>
|
||||
</div>
|
||||
<template v-if="menuOpen">
|
||||
<div class="menu__backdrop" @click="menuOpen = false" />
|
||||
<ul class="menu__list" role="menu">
|
||||
<li role="none">
|
||||
<button
|
||||
type="button"
|
||||
role="menuitem"
|
||||
class="menu__item menu__item--danger"
|
||||
@click="askDelete"
|
||||
>
|
||||
Delete project
|
||||
</button>
|
||||
</li>
|
||||
</ul>
|
||||
</template>
|
||||
</div>
|
||||
|
||||
<textarea
|
||||
v-model="descriptionDraft"
|
||||
class="project-head__desc"
|
||||
rows="2"
|
||||
maxlength="2000"
|
||||
placeholder="Add a description"
|
||||
aria-label="Project description"
|
||||
@blur="saveDescription"
|
||||
/>
|
||||
</div>
|
||||
|
||||
<p v-if="actionError" class="form-error">{{ actionError }}</p>
|
||||
|
||||
Reference in New Issue
Block a user