Skip to main content
Version: v1 (Current)

Phase 4: Details View

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 3 complete Jira: EZ-2206

Overview​

Implement the app details view that displays comprehensive information about a selected app, including long description, permissions/dependencies, screenshots with lightbox, and documentation tab with markdown rendering.

Objectives​

  • Build AppStoreDetails.vue component
  • Implement tabs for Details and Documentation
  • Add screenshot lightbox functionality
  • Integrate markdown rendering for readme
  • Wire up back navigation and add-to-project buttons
  • Load details data from API endpoint

Implementation Steps​

Step 1: Install marked for Markdown Rendering​

cd /Users/stephenpeek/Develop/gramercy/gxp/main
docker compose exec vite npm install marked

Step 2: Build AppStoreDetails.vue​

File: resources/js/Components/Mod/AppStoreModal/AppStoreDetails.vue

<template>
<div class="app-details-view">
<!-- Header with app info and actions -->
<div class="details-header d-flex justify-content-between align-items-start mb-4">
<div class="d-flex gap-3">
<div
class="app-icon-large d-flex align-items-center justify-content-center rounded"
:style="{
backgroundColor: app.background_color || '#3490dc',
width: '80px',
height: '80px'
}"
>
<FontAwesomeIcon
:icon="app.icon || 'cube'"
size="3x"
class="text-white"
/>
</div>
<div>
<h4 class="mb-1">{{ app.name }}</h4>
<span class="badge bg-secondary mb-2">
v{{ appDetails.default_version }}
</span>
<div>
<button
type="button"
class="btn btn-primary btn-sm"
@click="$emit('add', app)"
>
<FontAwesomeIcon icon="plus" class="me-2" />
Add to Project
</button>
</div>
</div>
</div>

<button
type="button"
class="btn btn-light btn-sm rounded-circle"
@click="$emit('back')"
>
<FontAwesomeIcon icon="times" />
</button>
</div>

<!-- Bootstrap Tabs -->
<ul class="nav nav-tabs mb-3" role="tablist">
<li class="nav-item" role="presentation">
<button
class="nav-link"
:class="{ active: activeTab === 'details' }"
type="button"
@click="activeTab = 'details'"
>
App Details
</button>
</li>
<li v-if="appDetails.readme" class="nav-item" role="presentation">
<button
class="nav-link"
:class="{ active: activeTab === 'docs' }"
type="button"
@click="activeTab = 'docs'"
>
Documentation
</button>
</li>
</ul>

<div class="tab-content">
<!-- Details Tab -->
<div
class="tab-pane"
:class="{ 'active show': activeTab === 'details' }"
>
<!-- Long Description -->
<div v-if="appDetails.long_description" class="mb-4">
<h6 class="text-muted mb-2">Description</h6>
<p>{{ appDetails.long_description }}</p>
</div>

<!-- Permissions & Dependencies Section -->
<div v-if="appDetails.dependencies?.length" class="mb-4">
<h6 class="text-muted mb-3">Permissions & Dependencies</h6>
<div class="row">
<div
v-for="dep in appDetails.dependencies"
:key="dep.identifier"
class="col-md-6 mb-3"
>
<div class="permission-card p-3 border rounded">
<h6>{{ dep.model }}</h6>
<div v-if="dep.permissions?.length" class="mb-2">
<small class="text-muted d-block">Permissions:</small>
<ul class="small mb-0">
<li v-for="perm in dep.permissions" :key="perm">
{{ perm }}
</li>
</ul>
</div>
<div v-if="dep.events?.length">
<small class="text-muted d-block">Events:</small>
<ul class="small mb-0">
<li v-for="event in dep.events" :key="event">
{{ event }}
</li>
</ul>
</div>
</div>
</div>
</div>
</div>

<!-- Screenshots Grid -->
<div v-if="appDetails.screenshots?.length" class="mb-4">
<h6 class="text-muted mb-3">Screenshots</h6>
<div class="screenshots-grid row g-2">
<div
v-for="screenshot in appDetails.screenshots"
:key="screenshot.id"
class="col-md-4"
>
<img
:src="screenshot.url"
:alt="screenshot.caption"
class="img-fluid rounded cursor-pointer"
style="cursor: pointer"
@click="openLightbox(screenshot)"
/>
</div>
</div>
</div>
</div>

<!-- Documentation Tab -->
<div
v-if="appDetails.readme"
class="tab-pane"
:class="{ 'active show': activeTab === 'docs' }"
>
<div class="markdown-content" v-html="renderedMarkdown"></div>
</div>
</div>

<!-- Bottom Actions -->
<div class="details-footer d-flex justify-content-between pt-3 border-top mt-4">
<button type="button" class="btn btn-light" @click="$emit('back')">
<FontAwesomeIcon icon="arrow-left" class="me-2" />
Back to App List
</button>
<button type="button" class="btn btn-primary" @click="$emit('add', app)">
Add to Project
</button>
</div>

<!-- Bootstrap Modal for Screenshot Lightbox -->
<div
class="modal fade"
:class="{ show: lightboxOpen }"
:style="{ display: lightboxOpen ? 'block' : 'none' }"
tabindex="-1"
@click.self="closeLightbox"
>
<div class="modal-dialog modal-xl modal-dialog-centered">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title">{{ currentScreenshot?.caption }}</h5>
<button type="button" class="btn-close" @click="closeLightbox"></button>
</div>
<div class="modal-body p-0">
<img :src="currentScreenshot?.url" class="img-fluid w-100" />
</div>
</div>
</div>
</div>
<div v-if="lightboxOpen" class="modal-backdrop fade show"></div>
</div>
</template>

<script setup>
import { ref, computed } from 'vue'
import { FontAwesomeIcon } from '@fortawesome/vue-fontawesome'
import { marked } from 'marked'

const props = defineProps({
app: {
type: Object,
required: true
},
appDetails: {
type: Object,
required: true
}
})

defineEmits(['back', 'add'])

const activeTab = ref('details')
const lightboxOpen = ref(false)
const currentScreenshot = ref(null)

const renderedMarkdown = computed(() => {
if (!props.appDetails.readme) return ''
return marked(props.appDetails.readme)
})

const openLightbox = (screenshot) => {
currentScreenshot.value = screenshot
lightboxOpen.value = true
document.body.classList.add('modal-open')
}

const closeLightbox = () => {
lightboxOpen.value = false
currentScreenshot.value = null
document.body.classList.remove('modal-open')
}
</script>

<style scoped>
.markdown-content {
padding: 20px;
}

.markdown-content :deep(h1),
.markdown-content :deep(h2),
.markdown-content :deep(h3) {
margin-top: 1.5rem;
margin-bottom: 1rem;
}

.markdown-content :deep(code) {
background: #f5f5f5;
padding: 2px 6px;
border-radius: 3px;
font-size: 0.9em;
}

.markdown-content :deep(pre) {
background: #f5f5f5;
padding: 15px;
border-radius: 5px;
overflow-x: auto;
}

.cursor-pointer {
cursor: pointer;
transition: transform 0.2s;
}

.cursor-pointer:hover {
transform: scale(1.05);
}
</style>

Testing:

  • Verify details display correctly
  • Test tab switching
  • Click screenshots to open lightbox
  • Check markdown rendering
  • Test back navigation

Step 3: Update AppStoreModal.vue with Details View​

Add import:

import AppStoreDetails from './AppStoreDetails.vue'

Add data refs:

const selectedApp = ref(null)
const appDetails = ref(null)

Replace placeholder details section in template:

<!-- Details View -->
<div v-else-if="currentView === 'details'" class="p-4">
<AppStoreDetails
:app="selectedApp"
:app-details="appDetails"
@back="backToBrowse"
@add="showConfig"
/>
</div>

Replace showDetails method:

const showDetails = async (app) => {
loading.value = true
selectedApp.value = app
viewHistory.value.push(currentView.value)

try {
const res = await http.get(
route('dashboard.plugins.pages.app-store-details', {
page: app.slug
})
)
appDetails.value = res.data
currentView.value = 'details'
} catch (err) {
toast.error('Failed to load app details')
console.error(err)
// Revert view on error
viewHistory.value.pop()
} finally {
loading.value = false
}
}

Update backToBrowse to clear selected app:

const backToBrowse = () => {
const previousView = viewHistory.value.pop()
currentView.value = previousView || 'browse'

if (currentView.value === 'browse') {
selectedApp.value = null
appDetails.value = null
}
}

Step 4: Manual Testing Checklist​

Details View:

  1. Click "Details" on an app from grid/list view
  2. Verify modal switches to details view
  3. Check app icon, name, and version display
  4. Verify "Add to Project" button shows in header

Details Tab:

  1. Read long description
  2. Check permissions/dependencies cards display
  3. Verify permissions and events lists show
  4. Click on a screenshot - lightbox should open
  5. Close lightbox with X button or click outside
  6. Click another screenshot - lightbox updates

Documentation Tab:

  1. If app has readme, verify Documentation tab appears
  2. Click Documentation tab
  3. Check markdown renders correctly (headings, code blocks, lists)
  4. Switch back to Details tab

Navigation:

  1. Click "Back to App List" button - should return to browse view
  2. Click close button on header - should return to browse view
  3. Click "Add to Project" button - should show toast (placeholder for Phase 5)

Error Handling:

  1. Test with app that has no current version
  2. Test with app that has no screenshots
  3. Test with app that has no readme
  4. Verify graceful degradation

Acceptance Criteria​

  • Details view displays app information correctly
  • Tabs switch between Details and Documentation
  • Documentation tab only shows if readme exists
  • Markdown renders correctly with proper styling
  • Screenshots grid displays properly
  • Lightbox opens and closes correctly
  • Lightbox displays correct screenshot
  • Permissions/dependencies cards show all info
  • Back navigation works correctly
  • Loading state shows during API call
  • Error handling works gracefully

Files Created​

  • resources/js/Components/Mod/AppStoreModal/AppStoreDetails.vue

Files Modified​

  • resources/js/Components/Mod/AppStoreModal/AppStoreModal.vue
  • package.json (added marked dependency)

Next Phase​

After this phase is complete and manual testing passes, proceed to Phase 5: Configuration Form.