Add recent sessions display on home page
Users can now see and click on previous sessions from the home page without having to create a new session. Shows up to 6 most recent sessions with: - Session ID and status (created/completed) - First 100 chars of prompt - Session creation date Features: - Fetches sessions from new GET /api/collaborate endpoint - Clickable cards to open existing sessions - Beautiful glassmorphic cards with hover effects - Responsive grid layout 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
5be5347a00
commit
c318690766
@ -1,5 +1,5 @@
|
|||||||
<script setup>
|
<script setup>
|
||||||
import { ref, computed } from 'vue'
|
import { ref, computed, onMounted } from 'vue'
|
||||||
import { useCollaborationStore } from '../stores/collaboration'
|
import { useCollaborationStore } from '../stores/collaboration'
|
||||||
|
|
||||||
const emit = defineEmits(['session-created'])
|
const emit = defineEmits(['session-created'])
|
||||||
@ -10,6 +10,25 @@ const prompt = ref('')
|
|||||||
const contextFile = ref(null)
|
const contextFile = ref(null)
|
||||||
const agentCount = ref(7)
|
const agentCount = ref(7)
|
||||||
const isCreating = ref(false)
|
const isCreating = ref(false)
|
||||||
|
const previousSessions = ref([])
|
||||||
|
const loadingPreviousSessions = ref(false)
|
||||||
|
|
||||||
|
onMounted(async () => {
|
||||||
|
loadingPreviousSessions.value = true
|
||||||
|
try {
|
||||||
|
const response = await fetch('/api/collaborate')
|
||||||
|
const data = await response.json()
|
||||||
|
previousSessions.value = data.sessions || []
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Error loading previous sessions:', error)
|
||||||
|
} finally {
|
||||||
|
loadingPreviousSessions.value = false
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
const handleOpenSession = (sessionId) => {
|
||||||
|
emit('session-created', { sessionId })
|
||||||
|
}
|
||||||
|
|
||||||
const agentOptions = computed(() => {
|
const agentOptions = computed(() => {
|
||||||
return Array.from({ length: 48 }, (_, i) => ({
|
return Array.from({ length: 48 }, (_, i) => ({
|
||||||
@ -182,6 +201,27 @@ const removeFile = () => {
|
|||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
|
<!-- Previous Sessions -->
|
||||||
|
<div v-if="previousSessions.length > 0" class="previous-sessions-section">
|
||||||
|
<h2>Recent Sessions</h2>
|
||||||
|
<div class="sessions-grid">
|
||||||
|
<div
|
||||||
|
v-for="session in previousSessions.slice(0, 6)"
|
||||||
|
:key="session.sessionId"
|
||||||
|
@click="handleOpenSession(session.sessionId)"
|
||||||
|
class="session-card"
|
||||||
|
:class="{ 'status-completed': session.status === 'completed' }"
|
||||||
|
>
|
||||||
|
<div class="session-header">
|
||||||
|
<span class="session-id">#{{ session.sessionId }}</span>
|
||||||
|
<span class="session-status">{{ session.status }}</span>
|
||||||
|
</div>
|
||||||
|
<p class="session-prompt">{{ session.prompt.substring(0, 100) }}...</p>
|
||||||
|
<p class="session-date">{{ new Date(session.createdAt).toLocaleDateString() }}</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<footer class="footer">
|
<footer class="footer">
|
||||||
<p>Typical session: 2-5 rounds for complete consensus. Output format: Markdown</p>
|
<p>Typical session: 2-5 rounds for complete consensus. Output format: Markdown</p>
|
||||||
</footer>
|
</footer>
|
||||||
@ -501,6 +541,82 @@ const removeFile = () => {
|
|||||||
font-size: 0.95rem;
|
font-size: 0.95rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.previous-sessions-section {
|
||||||
|
margin-top: 3rem;
|
||||||
|
padding-top: 2rem;
|
||||||
|
border-top: 1px solid rgba(102, 126, 234, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.previous-sessions-section h2 {
|
||||||
|
font-size: 1.5rem;
|
||||||
|
margin-bottom: 1.5rem;
|
||||||
|
color: rgba(102, 126, 234, 0.9);
|
||||||
|
}
|
||||||
|
|
||||||
|
.sessions-grid {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
|
||||||
|
gap: 1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.session-card {
|
||||||
|
padding: 1.25rem;
|
||||||
|
background: rgba(255, 255, 255, 0.06);
|
||||||
|
border: 1px solid rgba(102, 126, 234, 0.3);
|
||||||
|
border-radius: 12px;
|
||||||
|
cursor: pointer;
|
||||||
|
transition: all 0.3s ease;
|
||||||
|
backdrop-filter: blur(10px);
|
||||||
|
}
|
||||||
|
|
||||||
|
.session-card:hover {
|
||||||
|
background: rgba(102, 126, 234, 0.15);
|
||||||
|
border-color: rgba(102, 126, 234, 0.5);
|
||||||
|
transform: translateY(-2px);
|
||||||
|
box-shadow: 0 8px 24px rgba(102, 126, 234, 0.2);
|
||||||
|
}
|
||||||
|
|
||||||
|
.session-header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 0.75rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.session-id {
|
||||||
|
font-weight: 700;
|
||||||
|
color: rgba(102, 126, 234, 0.9);
|
||||||
|
font-size: 1.1rem;
|
||||||
|
}
|
||||||
|
|
||||||
|
.session-status {
|
||||||
|
padding: 0.25rem 0.75rem;
|
||||||
|
background: rgba(76, 175, 80, 0.25);
|
||||||
|
color: rgba(76, 175, 80, 0.9);
|
||||||
|
border-radius: 20px;
|
||||||
|
font-size: 0.75rem;
|
||||||
|
font-weight: 600;
|
||||||
|
text-transform: capitalize;
|
||||||
|
}
|
||||||
|
|
||||||
|
.session-card.status-completed .session-status {
|
||||||
|
background: rgba(76, 175, 80, 0.3);
|
||||||
|
color: rgba(76, 175, 80, 0.95);
|
||||||
|
}
|
||||||
|
|
||||||
|
.session-prompt {
|
||||||
|
margin: 0.75rem 0;
|
||||||
|
color: rgba(255, 255, 255, 0.7);
|
||||||
|
font-size: 0.9rem;
|
||||||
|
line-height: 1.4;
|
||||||
|
}
|
||||||
|
|
||||||
|
.session-date {
|
||||||
|
margin: 0;
|
||||||
|
color: rgba(255, 255, 255, 0.5);
|
||||||
|
font-size: 0.85rem;
|
||||||
|
}
|
||||||
|
|
||||||
@media (max-width: 768px) {
|
@media (max-width: 768px) {
|
||||||
.collaborative-input {
|
.collaborative-input {
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user