139 lines
3.3 KiB
Vue
139 lines
3.3 KiB
Vue
<template>
|
|
<div>
|
|
<div class="back-link">
|
|
<NuxtLink to="/member/my-updates">← Back to My Updates</NuxtLink>
|
|
</div>
|
|
|
|
<div class="form-header">
|
|
<h1>New Update</h1>
|
|
<p>Share what you're working on with the community</p>
|
|
</div>
|
|
|
|
<form @submit.prevent="handleSubmit" class="update-form">
|
|
<div class="field">
|
|
<label class="section-label">Content</label>
|
|
<textarea
|
|
v-model="form.content"
|
|
rows="8"
|
|
required
|
|
placeholder="What's on your mind? Share a project update, milestone, or thought..."
|
|
:disabled="saving"
|
|
></textarea>
|
|
<div class="char-count">{{ form.content.length }} / 50000</div>
|
|
</div>
|
|
|
|
<div class="field">
|
|
<label class="section-label">Visibility</label>
|
|
<select v-model="form.privacy" :disabled="saving">
|
|
<option value="members">Members only</option>
|
|
<option value="public">Public</option>
|
|
<option value="private">Private (only you)</option>
|
|
</select>
|
|
</div>
|
|
|
|
<div class="form-actions">
|
|
<NuxtLink to="/member/my-updates" class="btn">Cancel</NuxtLink>
|
|
<button
|
|
type="submit"
|
|
class="btn btn-primary"
|
|
:disabled="saving || !form.content.trim()"
|
|
>
|
|
{{ saving ? 'Posting...' : 'Post Update' }}
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup>
|
|
definePageMeta({ middleware: 'auth' })
|
|
|
|
const toast = useToast()
|
|
|
|
const form = ref({
|
|
content: '',
|
|
privacy: 'members',
|
|
})
|
|
const saving = ref(false)
|
|
|
|
const handleSubmit = async () => {
|
|
saving.value = true
|
|
try {
|
|
await $fetch('/api/updates', {
|
|
method: 'POST',
|
|
body: { content: form.value.content, privacy: form.value.privacy },
|
|
})
|
|
toast.add({ title: 'Update posted!', color: 'green' })
|
|
navigateTo('/member/my-updates')
|
|
} catch (err) {
|
|
toast.add({
|
|
title: 'Failed to post update',
|
|
description: err.data?.statusMessage || 'Please try again.',
|
|
color: 'red',
|
|
})
|
|
} finally {
|
|
saving.value = false
|
|
}
|
|
}
|
|
|
|
useHead({ title: 'New Update - Ghost Guild' })
|
|
</script>
|
|
|
|
<style scoped>
|
|
.back-link {
|
|
padding: 12px 32px;
|
|
border-bottom: 1px dashed var(--border);
|
|
font-size: 12px;
|
|
}
|
|
.back-link a { color: var(--candle); text-decoration: none; }
|
|
|
|
.form-header {
|
|
padding: 28px 32px 0;
|
|
border-bottom: 1px dashed var(--border);
|
|
padding-bottom: 20px;
|
|
}
|
|
.form-header h1 {
|
|
font-family: 'Brygada 1918', serif;
|
|
font-size: 24px;
|
|
font-weight: 600;
|
|
color: var(--text-bright);
|
|
margin-bottom: 4px;
|
|
}
|
|
.form-header p { font-size: 12px; color: var(--text-dim); }
|
|
|
|
.update-form {
|
|
padding: 24px 32px;
|
|
max-width: 640px;
|
|
display: flex;
|
|
flex-direction: column;
|
|
gap: 20px;
|
|
}
|
|
|
|
.field { display: flex; flex-direction: column; gap: 6px; }
|
|
|
|
textarea, select {
|
|
font-family: 'Commit Mono', monospace;
|
|
font-size: 13px;
|
|
background: var(--surface);
|
|
border: 1px dashed var(--border);
|
|
color: var(--text);
|
|
padding: 10px 12px;
|
|
resize: vertical;
|
|
width: 100%;
|
|
}
|
|
textarea:focus, select:focus { outline: none; border-color: var(--candle); }
|
|
textarea:disabled, select:disabled { opacity: 0.6; }
|
|
|
|
.char-count {
|
|
font-size: 11px;
|
|
color: var(--text-faint);
|
|
text-align: right;
|
|
}
|
|
|
|
.form-actions {
|
|
display: flex;
|
|
gap: 8px;
|
|
justify-content: flex-end;
|
|
padding-top: 4px;
|
|
}
|
|
</style>
|