vue-components
Vue 3 Component Architecture
Project Structure
src/
├── components/
│ ├── common/ # Shared components (BaseCard, ColorPicker, Toast)
│ └── [module-name]/ # Feature modules (cards + admin components)
├── composables/ # Reusable Vue composition functions
├── services/ # API services and utilities
└── types/ # TypeScript definitions
BaseCard Pattern
All dashboard cards extend BaseCard for consistency:
<template>
<BaseCard
title="Your Card Title"
:loading="loading"
:error="error"
>
<!-- Your content here -->
</BaseCard>
</template>
<script setup lang="ts">
import BaseCard from '../common/BaseCard.vue'
import { ref } from 'vue'
const loading = ref(false)
const error = ref<string | null>(null)
</script>
Available Components
- BaseCard: Base component for dashboard cards with consistent styling
- ColorPicker: ChurchTools-compatible color picker with 4-column grid, round swatches, v-model support
- Toast: Notification system with 4 types (success, error, warning, info), auto-dismiss, smooth animations
Available Composables
useToast: Toast notification managementuseTableSearch: Table search functionalityuseTableSorting: Table sorting with custom comparatorsuseTableResize: Responsive table handling
Component Usage Example
<template>
<BaseCard title="My Extension" :loading="loading" :error="error">
<p>Extension content here</p>
<ColorPicker v-model="selectedColor" />
<button @click="showSuccess" type="button">Show Toast</button>
</BaseCard>
<Toast />
</template>
<script setup lang="ts">
import BaseCard from './components/common/BaseCard.vue'
import ColorPicker from './components/common/ColorPicker.vue'
import Toast from './components/common/Toast.vue'
import { useToast } from './composables/useToast'
const { showToast } = useToast()
const showSuccess = () => showToast('Success!', 'Operation completed', 'success')
</script>
Module Structure
Each feature module has:
[ModuleName]Card.vue- Dashboard card component[ModuleName]Admin.vue- Admin/CRUD component
Code Style
- Use Vue 3 Composition API with
<script setup> - Use TypeScript strictly
- Import BaseCard from
../common/BaseCard.vue(relative paths) - Always use
type="button"on buttons to prevent form submission
More from bwl21/bwl-flyer-generator
git-conventions
Apply when committing code, creating branches, or preparing pull requests. Covers conventional commit format, branch naming, co-author attribution, and pre-commit checklist.
12common-pitfalls
Apply when debugging errors, reviewing code for issues, or encountering unexpected behavior. Contains known mistakes with ChurchTools API, Vue components, TypeScript, Safari cookies, and form handling.
8churchtools-api
Apply when making API calls to ChurchTools, using churchtoolsClient methods, handling API responses, or working with Tags API. Covers correct HTTP method names, parameter structure, and response handling patterns.
8development-workflow
Apply when setting up the development environment, running dev server, building, testing, or deploying the extension. Covers npm commands, CORS configuration, debugging, and deployment to ChurchTools.
7