chat sessions in project view

This commit is contained in:
Storme-bit
2026-04-14 02:03:54 -07:00
parent 996db6d4f1
commit eb702624c3
6 changed files with 18 additions and 18 deletions

View File

@@ -186,21 +186,21 @@ export async function fetchProjects() {
return res.json();
}
export async function createProject({ name, description, colour, icon, projectOnly }) {
export async function createProject({ name, description, colour, icon, isolated }) {
const res = await fetch(`${BASE_URL}/projects`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ name, description, colour, icon, projectOnly: projectOnly ? 1 : 0 }),
body: JSON.stringify({ name, description, colour, icon, isolated: isolated ? 1 : 0 }),
});
if (!res.ok) throw new Error(`Failed to create project: ${res.status}`);
return res.json();
}
export async function updateProject(id, { name, description, colour, icon, projectOnly }) {
export async function updateProject(id, { name, description, colour, icon, isolated }) {
const res = await fetch(`${BASE_URL}/projects/${id}`, {
method: 'PATCH',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ name, description, colour, icon, projectOnly: projectOnly ? 1 : 0}),
body: JSON.stringify({ name, description, colour, icon, isolated: isolated ? 1 : 0}),
});
if (!res.ok) throw new Error(`Failed to update project: ${res.status}`);
return res.json();

View File

@@ -6,7 +6,7 @@ export default function ProjectModal({ project, mode, onSave, onDelete, onClose
const [name, setName] = useState(project?.name ?? '');
const [description, setDescription] = useState(project?.description ?? '');
const [colour, setColour] = useState(project?.colour ?? COLOURS[0]);
const [projectOnly, setProjectOnly] = useState(project?.projectOnly === 1);
const [isolated, setIsolated] = useState(project?.isolated === 1);
const inputRef = useRef(null);
useEffect(() => {
@@ -16,7 +16,7 @@ export default function ProjectModal({ project, mode, onSave, onDelete, onClose
function handleSubmit() {
const trimmed = name.trim();
if (!trimmed) return;
onSave({ name: trimmed, description: description.trim() || null, colour, icon: null, projectOnly });
onSave({ name: trimmed, description: description.trim() || null, colour, icon: null, isolated });
onClose();
}
@@ -131,20 +131,20 @@ export default function ProjectModal({ project, mode, onSave, onDelete, onClose
</div>
<button
type="button"
onClick={() => setProjectOnly(i => !i)}
onClick={() => setIsolated(i => !i)}
style={{
width: '40px', height: '22px', borderRadius: '11px', flexShrink: 0,
background: projectOnly ? 'var(--accent-hover)' : 'var(--bg-elevated)',
background: isolated ? 'var(--accent-hover)' : 'var(--bg-elevated)',
border: '1px solid var(--border)',
position: 'relative', cursor: 'pointer', transition: 'background 0.2s',
}}
>
<span style={{
position: 'absolute', top: '3px',
left: projectOnly ? '20px' : '3px',
left: isolated ? '20px' : '3px',
width: '14px', height: '14px',
borderRadius: '50%',
background: projectOnly ? 'white' : 'var(--text-muted)',
background: isolated ? 'white' : 'var(--text-muted)',
transition: 'left 0.2s',
}} />
</button>

View File

@@ -72,7 +72,7 @@ export default function ProjectView({ project, onNavigate, onSelectSession, onNe
<h1 style={{ fontSize: '22px', fontWeight: 600, color: 'var(--text-primary)' }}>
{project.name}
</h1>
{project.projectOnly === 1 && (
{project.isolated === 1 && (
<span style={{
fontSize: '11px', fontWeight: 500,
padding: '2px 8px', borderRadius: '99px',