Phase 3: Browse View Components
Historical design/implementation plan. It is retained as background, not a statement that every proposed feature is available. Use the current component/project guides and the deployed editor before following its recipes.
Estimated Effort: 3-4 hours Dependencies: Phase 2 complete Jira: EZ-2206
Overview
Implement the card and list view components for browsing apps. This includes the grid layout, list table layout, individual app cards with hover interactions, and view mode toggle with persistence.
Objectives
- Build AppStoreCard.vue with hover overlay
- Build AppStoreGrid.vue for card layout
- Build AppStoreList.vue for table layout
- Implement view mode toggle
- Integrate with tableStyleStore for persistence
- Wire up "Details" and "Add" button handlers
Implementation Steps
Step 1: Build AppStoreCard.vue
File: resources/js/Components/Mod/AppStoreModal/AppStoreCard.vue
<template>
<div
class="app-card card h-100 position-relative"
@mouseenter="hovering = true"
@mouseleave="hovering = false"
>
<div class="card-body">
<div
class="app-icon mb-3 d-flex align-items-center justify-content-center rounded"
:style="{
backgroundColor: app.background_color || '#3490dc',
width: '64px',
height: '64px'
}"
>
<FontAwesomeIcon
:icon="app.icon || 'cube'"
size="2x"
class="text-white"
/>
</div>
<h5 class="card-title mb-2">{{ app.name }}</h5>
<p class="card-text text-muted small mb-0">
{{ app.short_description }}
</p>
<div v-if="app.tags && app.tags.length > 0" class="mt-2">
<span
v-for="tag in app.tags.slice(0, 3)"
:key="tag"
class="badge bg-secondary me-1 text-xs"
>
{{ tag }}
</span>
<span v-if="app.tags.length > 3" class="text-muted small">
+{{ app.tags.length - 3 }} more
</span>
</div>
</div>
<!-- Hover Overlay with fade transition -->
<Transition name="fade">
<div v-if="hovering" class="card-overlay">
<button
type="button"
class="btn btn-outline-primary btn-sm me-2"
@click.stop="$emit('details', app)"
>
<FontAwesomeIcon icon="info-circle" class="me-1" />
Details
</button>
<button
type="button"
class="btn btn-primary btn-sm"
@click.stop="$emit('add', app)"
>
<FontAwesomeIcon icon="plus" class="me-1" />
Add
</button>
</div>
</Transition>
</div>
</template>
<script setup>
import { ref } from 'vue'
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
defineProps({
app: {
type: Object,
required: true
}
})
defineEmits(['details', 'add'])
const hovering = ref(false)
</script>
<style scoped>
.card-overlay {
position: absolute;
inset: 0;
background: rgba(255, 255, 255, 0.8);
backdrop-filter: blur(4px);
display: flex;
gap: 12px;
align-items: center;
justify-content: center;
border-radius: inherit;
z-index: 10;
}
.fade-enter-active,
.fade-leave-active {
transition: opacity 0.2s ease;
}
.fade-enter-from,
.fade-leave-to {
opacity: 0;
}
.app-card {
cursor: pointer;
transition: transform 0.2s, box-shadow 0.2s;
}
.app-card:hover {
transform: translateY(-2px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
.text-xs {
font-size: 0.75rem;
}
</style>
Testing:
- Hover over card and verify overlay fades in
- Check buttons are clickable and emit correct events
- Verify app icon displays with background color
- Test that tags display correctly
Step 2: Build AppStoreGrid.vue
File: resources/js/Components/Mod/AppStoreModal/AppStoreGrid.vue
<template>
<div class="app-store-grid">
<!-- Header with count and view toggle -->
<div class="grid-header d-flex justify-content-between align-items-center mb-3">
<span class="text-muted">
{{ filteredApps.length }} app{{ filteredApps.length !== 1 ? 's' : '' }}
</span>
<button
type="button"
class="btn btn-sm btn-outline-primary"
@click="toggleViewMode"
>
<FontAwesomeIcon icon="list" />
List View
</button>
</div>
<!-- Empty State -->
<div
v-if="filteredApps.length === 0"
class="text-center py-5"
>
<FontAwesomeIcon icon="inbox" size="3x" class="text-muted mb-3" />
<p class="text-muted">No apps found matching your filters</p>
</div>
<!-- Grid of Apps -->
<div v-else class="app-grid row g-3">
<div
v-for="app in filteredApps"
:key="app.id"
class="col-12 col-md-6 col-lg-4"
>
<AppStoreCard
:app="app"
@details="$emit('details', app)"
@add="$emit('add', app)"
/>
</div>
</div>
</div>
</template>
<script setup>
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
import AppStoreCard from './AppStoreCard.vue'
defineProps({
filteredApps: {
type: Array,
default: () => []
}
})
const emit = defineEmits(['details', 'add', 'toggleViewMode'])
const toggleViewMode = () => {
emit('toggleViewMode')
}
</script>
<style scoped>
.app-grid {
min-height: 400px;
}
</style>
Testing:
- Verify grid displays apps in 3 columns (lg), 2 columns (md), 1 column (sm)
- Check empty state shows when no apps match filters
- Test toggle view mode button emits event
Step 3: Build AppStoreList.vue
File: resources/js/Components/Mod/AppStoreModal/AppStoreList.vue
<template>
<div class="app-store-list">
<!-- Header with count and view toggle -->
<div class="list-header d-flex justify-content-between align-items-center mb-3">
<span class="text-muted">
{{ filteredApps.length }} app{{ filteredApps.length !== 1 ? 's' : '' }}
</span>
<button
type="button"
class="btn btn-sm btn-outline-primary"
@click="toggleViewMode"
>
<FontAwesomeIcon icon="grid-2" />
Grid View
</button>
</div>
<!-- Empty State -->
<div
v-if="filteredApps.length === 0"
class="text-center py-5"
>
<FontAwesomeIcon icon="inbox" size="3x" class="text-muted mb-3" />
<p class="text-muted">No apps found matching your filters</p>
</div>
<!-- Table of Apps -->
<div v-else class="table-responsive">
<table class="table table-hover">
<thead>
<tr>
<th style="width: 60px"></th>
<th>Name</th>
<th>Description</th>
<th>Tags</th>
<th style="width: 200px">Actions</th>
</tr>
</thead>
<tbody>
<tr v-for="app in filteredApps" :key="app.id">
<td>
<div
class="app-icon-small d-flex align-items-center justify-content-center rounded"
:style="{
backgroundColor: app.background_color || '#3490dc',
width: '40px',
height: '40px'
}"
>
<FontAwesomeIcon
:icon="app.icon || 'cube'"
class="text-white"
/>
</div>
</td>
<td class="fw-semibold align-middle">{{ app.name }}</td>
<td class="text-muted align-middle">{{ app.short_description }}</td>
<td class="align-middle">
<span
v-for="tag in app.tags.slice(0, 2)"
:key="tag"
class="badge bg-secondary me-1 text-xs"
>
{{ tag }}
</span>
<span v-if="app.tags.length > 2" class="text-muted small">
+{{ app.tags.length - 2 }}
</span>
</td>
<td class="align-middle">
<button
type="button"
class="btn btn-outline-primary btn-sm me-2"
@click="$emit('details', app)"
>
Details
</button>
<button
type="button"
class="btn btn-primary btn-sm"
@click="$emit('add', app)"
>
Add
</button>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</template>
<script setup>
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
defineProps({
filteredApps: {
type: Array,
default: () => []
}
})
const emit = defineEmits(['details', 'add', 'toggleViewMode'])
const toggleViewMode = () => {
emit('toggleViewMode')
}
</script>
<style scoped>
.text-xs {
font-size: 0.75rem;
}
</style>
Testing:
- Verify table displays all columns correctly
- Check icons display with correct colors
- Test action buttons emit correct events
- Verify empty state shows
Step 4: Update AppStoreModal.vue with Grid/List Views
File: resources/js/Components/Mod/AppStoreModal/AppStoreModal.vue
Add imports:
import { useTableStyle } from '@/Store/tableStyleStore'
import { storeToRefs } from 'pinia'
import AppStoreGrid from './AppStoreGrid.vue'
import AppStoreList from './AppStoreList.vue'
Add after other refs:
// View mode (card vs list)
const tableStyleStore = useTableStyle('app-store-modal')
const { tableStyle } = storeToRefs(tableStyleStore)
const viewMode = computed(() => tableStyle.value || 'card_view')
const toggleViewMode = () => {
tableStyleStore.toggleStyle()
}
Replace the placeholder grid/list section in the template:
<!-- Grid/List View -->
<div class="p-4 flex-grow-1 overflow-auto">
<AppStoreGrid
v-if="viewMode === 'card_view'"
:filtered-apps="filteredApps"
@details="showDetails"
@add="showConfig"
@toggle-view-mode="toggleViewMode"
/>
<AppStoreList
v-else
:filtered-apps="filteredApps"
@details="showDetails"
@add="showConfig"
@toggle-view-mode="toggleViewMode"
/>
</div>
Add placeholder methods for now:
const showDetails = (app) => {
console.log('Show details for:', app)
// Will implement in Phase 4
toast.info('Details view coming in Phase 4')
}
const showConfig = (app) => {
console.log('Show config for:', app)
// Will implement in Phase 5
toast.info('Configuration form coming in Phase 5')
}
Testing:
- Toggle between grid and list view
- Verify preference persists after closing/reopening modal
- Check that view mode is consistent across browser tabs (if tableStyleStore supports it)
Step 5: Manual Testing Checklist
Grid View:
- Open modal, should default to grid view
- Verify cards display in 3 columns on large screens
- Hover over card - overlay should fade in smoothly
- Click "Details" button - should show toast (placeholder)
- Click "Add" button - should show toast (placeholder)
- Resize browser - grid should be responsive
List View:
- Click "List View" button
- Verify table displays with all columns
- Check icons show with correct colors
- Click action buttons - should show toasts
- Verify view mode persists on modal close/reopen
View Mode Persistence:
- Switch to list view
- Close modal
- Open modal again - should still be in list view
- Switch back to grid view
- Refresh page and open modal - should be in grid view
Empty States:
- Type search query that matches nothing
- Verify empty state shows in both grid and list views
- Clear search - apps should reappear
Acceptance Criteria
- AppStoreCard displays app info correctly with icon, name, description, tags
- Hover overlay fades in smoothly on card hover
- Grid view displays cards in responsive columns
- List view displays apps in table format
- View mode toggle works and button labels are correct
- View mode preference persists using tableStyleStore
- Empty states display when no apps match filters
- Details and Add buttons emit correct events
- All transitions are smooth
Files Created
resources/js/Components/Mod/AppStoreModal/AppStoreCard.vueresources/js/Components/Mod/AppStoreModal/AppStoreGrid.vueresources/js/Components/Mod/AppStoreModal/AppStoreList.vue
Files Modified
resources/js/Components/Mod/AppStoreModal/AppStoreModal.vue
Next Phase
After this phase is complete and manual testing passes, proceed to Phase 4: Details View.