Includes all Phase 1 features: - Search-first navigation with auto-complete - Responsive reading interface (desktop/tablet/mobile) - 4 customization presets + full fine-tuning controls - Layered details panel with notes, bookmarks, highlights - Smart offline caching with IndexedDB and auto-sync - Full accessibility (WCAG 2.1 AA) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
63 lines
1.3 KiB
TypeScript
63 lines
1.3 KiB
TypeScript
import { CollectionConfig } from 'payload';
|
|
|
|
export const Highlights: CollectionConfig = {
|
|
slug: 'highlights',
|
|
admin: {
|
|
useAsTitle: 'id',
|
|
defaultColumns: ['user', 'color', 'createdAt'],
|
|
group: 'User Content',
|
|
},
|
|
fields: [
|
|
{
|
|
name: 'user',
|
|
type: 'relationship',
|
|
relationTo: 'users',
|
|
required: true,
|
|
index: true,
|
|
},
|
|
{
|
|
name: 'verse',
|
|
type: 'relationship',
|
|
relationTo: 'bible-verses',
|
|
required: true,
|
|
},
|
|
{
|
|
name: 'color',
|
|
type: 'select',
|
|
options: [
|
|
{ label: 'Yellow', value: 'yellow' },
|
|
{ label: 'Green', value: 'green' },
|
|
{ label: 'Blue', value: 'blue' },
|
|
{ label: 'Red', value: 'red' },
|
|
{ label: 'Pink', value: 'pink' },
|
|
],
|
|
defaultValue: 'yellow',
|
|
required: true,
|
|
},
|
|
{
|
|
name: 'note',
|
|
type: 'textarea',
|
|
},
|
|
],
|
|
access: {
|
|
read: ({ req }) => {
|
|
if (!req.user) {
|
|
return false;
|
|
}
|
|
|
|
if (req.user.role === 'admin' || req.user.role === 'super-admin') {
|
|
return true;
|
|
}
|
|
|
|
return {
|
|
user: {
|
|
equals: req.user.id,
|
|
},
|
|
};
|
|
},
|
|
create: ({ req }) => !!req.user,
|
|
update: ({ req }) => !!req.user,
|
|
delete: ({ req }) => !!req.user,
|
|
},
|
|
};
|