@jhits/plugin-blog 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +216 -0
- package/package.json +57 -0
- package/src/api/README.md +224 -0
- package/src/api/categories.ts +43 -0
- package/src/api/check-title.ts +60 -0
- package/src/api/handler.ts +419 -0
- package/src/api/index.ts +33 -0
- package/src/api/route.ts +116 -0
- package/src/api/router.ts +114 -0
- package/src/api-server.ts +11 -0
- package/src/config.ts +161 -0
- package/src/hooks/README.md +91 -0
- package/src/hooks/index.ts +8 -0
- package/src/hooks/useBlog.ts +85 -0
- package/src/hooks/useBlogs.ts +123 -0
- package/src/index.server.ts +12 -0
- package/src/index.tsx +354 -0
- package/src/init.tsx +72 -0
- package/src/lib/blocks/BlockRenderer.tsx +141 -0
- package/src/lib/blocks/index.ts +6 -0
- package/src/lib/index.ts +9 -0
- package/src/lib/layouts/blocks/ColumnsBlock.tsx +134 -0
- package/src/lib/layouts/blocks/SectionBlock.tsx +104 -0
- package/src/lib/layouts/blocks/index.ts +8 -0
- package/src/lib/layouts/index.ts +52 -0
- package/src/lib/layouts/registerLayoutBlocks.ts +59 -0
- package/src/lib/mappers/apiMapper.ts +223 -0
- package/src/lib/migration/index.ts +6 -0
- package/src/lib/migration/mapper.ts +140 -0
- package/src/lib/rich-text/RichTextEditor.tsx +826 -0
- package/src/lib/rich-text/RichTextPreview.tsx +210 -0
- package/src/lib/rich-text/index.ts +10 -0
- package/src/lib/utils/blockHelpers.ts +72 -0
- package/src/lib/utils/configValidation.ts +137 -0
- package/src/lib/utils/index.ts +8 -0
- package/src/lib/utils/slugify.ts +79 -0
- package/src/registry/BlockRegistry.ts +142 -0
- package/src/registry/index.ts +11 -0
- package/src/state/EditorContext.tsx +277 -0
- package/src/state/index.ts +8 -0
- package/src/state/reducer.ts +694 -0
- package/src/state/types.ts +160 -0
- package/src/types/block.ts +269 -0
- package/src/types/index.ts +15 -0
- package/src/types/post.ts +165 -0
- package/src/utils/README.md +75 -0
- package/src/utils/client.ts +122 -0
- package/src/utils/index.ts +9 -0
- package/src/views/CanvasEditor/BlockWrapper.tsx +459 -0
- package/src/views/CanvasEditor/CanvasEditorView.tsx +917 -0
- package/src/views/CanvasEditor/EditorBody.tsx +475 -0
- package/src/views/CanvasEditor/EditorHeader.tsx +179 -0
- package/src/views/CanvasEditor/LayoutContainer.tsx +494 -0
- package/src/views/CanvasEditor/SaveConfirmationModal.tsx +233 -0
- package/src/views/CanvasEditor/components/CustomBlockItem.tsx +92 -0
- package/src/views/CanvasEditor/components/FeaturedMediaSection.tsx +130 -0
- package/src/views/CanvasEditor/components/LibraryItem.tsx +80 -0
- package/src/views/CanvasEditor/components/PrivacySettingsSection.tsx +212 -0
- package/src/views/CanvasEditor/components/index.ts +17 -0
- package/src/views/CanvasEditor/index.ts +16 -0
- package/src/views/PostManager/EmptyState.tsx +42 -0
- package/src/views/PostManager/PostActionsMenu.tsx +112 -0
- package/src/views/PostManager/PostCards.tsx +192 -0
- package/src/views/PostManager/PostFilters.tsx +80 -0
- package/src/views/PostManager/PostManagerView.tsx +280 -0
- package/src/views/PostManager/PostStats.tsx +81 -0
- package/src/views/PostManager/PostTable.tsx +225 -0
- package/src/views/PostManager/index.ts +15 -0
- package/src/views/Preview/PreviewBridgeView.tsx +64 -0
- package/src/views/Preview/index.ts +7 -0
- package/src/views/README.md +82 -0
- package/src/views/Settings/SettingsView.tsx +298 -0
- package/src/views/Settings/index.ts +7 -0
- package/src/views/SlugSEO/SlugSEOManagerView.tsx +94 -0
- package/src/views/SlugSEO/index.ts +7 -0
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
# Blog Plugin Views
|
|
2
|
+
|
|
3
|
+
## Directory Structure
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
src/views/
|
|
7
|
+
├── PostManager/
|
|
8
|
+
│ ├── PostManagerView.tsx # Professional table layout for post management
|
|
9
|
+
│ └── index.ts
|
|
10
|
+
├── CanvasEditor/
|
|
11
|
+
│ ├── CanvasEditorView.tsx # Drag-and-drop block editor workspace
|
|
12
|
+
│ └── index.ts
|
|
13
|
+
├── SlugSEO/
|
|
14
|
+
│ ├── SlugSEOManagerView.tsx # URL slug and SEO metadata management
|
|
15
|
+
│ └── index.ts
|
|
16
|
+
└── Preview/
|
|
17
|
+
├── PreviewBridgeView.tsx # Live preview of blog posts
|
|
18
|
+
└── index.ts
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Design System Compliance
|
|
22
|
+
|
|
23
|
+
All views follow the dashboard's earth-tone design system:
|
|
24
|
+
|
|
25
|
+
- **Colors**: Neutral palette (neutral-100 to neutral-900), primary (violet-700)
|
|
26
|
+
- **Typography**:
|
|
27
|
+
- Headings: `font-black uppercase tracking-tighter`
|
|
28
|
+
- Labels: `text-[10px] font-black uppercase tracking-widest`
|
|
29
|
+
- Body: `font-sans`
|
|
30
|
+
- **Layout**:
|
|
31
|
+
- Containers: `rounded-[2.5rem]`
|
|
32
|
+
- Padding: `p-8`
|
|
33
|
+
- Backgrounds: `bg-white dark:bg-neutral-900`
|
|
34
|
+
- **Buttons**: `rounded-full`, uppercase, tracking-widest
|
|
35
|
+
- **Borders**: `border-neutral-300 dark:border-neutral-700`
|
|
36
|
+
|
|
37
|
+
## PostManagerView
|
|
38
|
+
|
|
39
|
+
Professional table layout with:
|
|
40
|
+
- Search and filter functionality
|
|
41
|
+
- Status badges (published, draft, scheduled, archived)
|
|
42
|
+
- Empty state with "Create Your First Post" CTA
|
|
43
|
+
- Action buttons (Edit, Preview, Delete)
|
|
44
|
+
- Mock data for development
|
|
45
|
+
|
|
46
|
+
## CanvasEditorView
|
|
47
|
+
|
|
48
|
+
Block editor workspace with:
|
|
49
|
+
- Toolbar with Back, Preview, and Save buttons
|
|
50
|
+
- Title input field
|
|
51
|
+
- Block canvas area
|
|
52
|
+
- Empty state for adding first block
|
|
53
|
+
- Integrated with EditorProvider for state management
|
|
54
|
+
|
|
55
|
+
## SlugSEOManagerView
|
|
56
|
+
|
|
57
|
+
SEO management interface with:
|
|
58
|
+
- URL slug editor with collision detection placeholder
|
|
59
|
+
- Google-style search result preview
|
|
60
|
+
- Meta description editor with character counter
|
|
61
|
+
|
|
62
|
+
## PreviewBridgeView
|
|
63
|
+
|
|
64
|
+
Live preview interface with:
|
|
65
|
+
- Header with Refresh and Open in New Tab buttons
|
|
66
|
+
- Preview container (ready for iframe or side-by-side panel)
|
|
67
|
+
- Placeholder for preview rendering
|
|
68
|
+
|
|
69
|
+
## Usage
|
|
70
|
+
|
|
71
|
+
Views are imported and used in the main `BlogPlugin` router:
|
|
72
|
+
|
|
73
|
+
```typescript
|
|
74
|
+
import { PostManagerView } from './views/PostManager';
|
|
75
|
+
import { CanvasEditorView } from './views/CanvasEditor';
|
|
76
|
+
// ... etc
|
|
77
|
+
|
|
78
|
+
// In router switch statement:
|
|
79
|
+
case 'posts':
|
|
80
|
+
return <PostManagerView siteId={siteId} locale={locale} />;
|
|
81
|
+
```
|
|
82
|
+
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Settings View - Development/Installation Screen
|
|
3
|
+
* Allows manual configuration of plugin settings (darkMode, backgroundColors)
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
'use client';
|
|
7
|
+
|
|
8
|
+
import React, { useState, useEffect } from 'react';
|
|
9
|
+
import { Save, RotateCcw, Palette, Moon, Sun } from 'lucide-react';
|
|
10
|
+
|
|
11
|
+
export interface SettingsViewProps {
|
|
12
|
+
siteId: string;
|
|
13
|
+
locale: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function SettingsView({ siteId, locale }: SettingsViewProps) {
|
|
17
|
+
// Get current config from window global
|
|
18
|
+
const getCurrentConfig = () => {
|
|
19
|
+
if (typeof window !== 'undefined' && (window as any).__JHITS_PLUGIN_PROPS__) {
|
|
20
|
+
const pluginProps = (window as any).__JHITS_PLUGIN_PROPS__['plugin-blog'];
|
|
21
|
+
return {
|
|
22
|
+
darkMode: pluginProps?.darkMode ?? true,
|
|
23
|
+
backgroundColors: pluginProps?.backgroundColors ?? {
|
|
24
|
+
light: '#ffffff',
|
|
25
|
+
dark: '#171717',
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
return {
|
|
30
|
+
darkMode: true,
|
|
31
|
+
backgroundColors: {
|
|
32
|
+
light: '#ffffff',
|
|
33
|
+
dark: '#171717',
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const [darkMode, setDarkMode] = useState<boolean>(getCurrentConfig().darkMode);
|
|
39
|
+
const [lightBg, setLightBg] = useState<string>(getCurrentConfig().backgroundColors.light);
|
|
40
|
+
const [darkBg, setDarkBg] = useState<string>(getCurrentConfig().backgroundColors.dark || '#171717');
|
|
41
|
+
const [hasChanges, setHasChanges] = useState<boolean>(false);
|
|
42
|
+
const [saved, setSaved] = useState<boolean>(false);
|
|
43
|
+
|
|
44
|
+
// Check for changes
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
const current = getCurrentConfig();
|
|
47
|
+
const hasChanges =
|
|
48
|
+
darkMode !== current.darkMode ||
|
|
49
|
+
lightBg !== current.backgroundColors.light ||
|
|
50
|
+
darkBg !== (current.backgroundColors.dark || '#171717');
|
|
51
|
+
setHasChanges(hasChanges);
|
|
52
|
+
setSaved(false);
|
|
53
|
+
}, [darkMode, lightBg, darkBg]);
|
|
54
|
+
|
|
55
|
+
// Save configuration
|
|
56
|
+
const handleSave = () => {
|
|
57
|
+
if (typeof window === 'undefined') return;
|
|
58
|
+
|
|
59
|
+
// Initialize window global if needed
|
|
60
|
+
if (!(window as any).__JHITS_PLUGIN_PROPS__) {
|
|
61
|
+
(window as any).__JHITS_PLUGIN_PROPS__ = {};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// Update configuration
|
|
65
|
+
(window as any).__JHITS_PLUGIN_PROPS__['plugin-blog'] = {
|
|
66
|
+
...((window as any).__JHITS_PLUGIN_PROPS__['plugin-blog'] || {}),
|
|
67
|
+
darkMode,
|
|
68
|
+
backgroundColors: {
|
|
69
|
+
light: lightBg,
|
|
70
|
+
dark: darkBg,
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
// Also save to localStorage for persistence
|
|
75
|
+
try {
|
|
76
|
+
localStorage.setItem('__JHITS_PLUGIN_BLOG_CONFIG__', JSON.stringify({
|
|
77
|
+
darkMode,
|
|
78
|
+
backgroundColors: {
|
|
79
|
+
light: lightBg,
|
|
80
|
+
dark: darkBg,
|
|
81
|
+
},
|
|
82
|
+
}));
|
|
83
|
+
} catch (e) {
|
|
84
|
+
console.warn('[SettingsView] Failed to save to localStorage:', e);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
setSaved(true);
|
|
88
|
+
setTimeout(() => setSaved(false), 2000);
|
|
89
|
+
|
|
90
|
+
// Trigger a custom event to notify other components
|
|
91
|
+
window.dispatchEvent(new CustomEvent('blog-plugin-config-updated', {
|
|
92
|
+
detail: { darkMode, backgroundColors: { light: lightBg, dark: darkBg } }
|
|
93
|
+
}));
|
|
94
|
+
|
|
95
|
+
console.log('[SettingsView] Configuration saved:', {
|
|
96
|
+
darkMode,
|
|
97
|
+
backgroundColors: { light: lightBg, dark: darkBg },
|
|
98
|
+
});
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
// Reset to defaults
|
|
102
|
+
const handleReset = () => {
|
|
103
|
+
setDarkMode(true);
|
|
104
|
+
setLightBg('#ffffff');
|
|
105
|
+
setDarkBg('#171717');
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
// Load from localStorage on mount
|
|
109
|
+
useEffect(() => {
|
|
110
|
+
try {
|
|
111
|
+
const saved = localStorage.getItem('__JHITS_PLUGIN_BLOG_CONFIG__');
|
|
112
|
+
if (saved) {
|
|
113
|
+
const config = JSON.parse(saved);
|
|
114
|
+
setDarkMode(config.darkMode ?? true);
|
|
115
|
+
setLightBg(config.backgroundColors?.light ?? '#ffffff');
|
|
116
|
+
setDarkBg(config.backgroundColors?.dark ?? '#171717');
|
|
117
|
+
}
|
|
118
|
+
} catch (e) {
|
|
119
|
+
console.warn('[SettingsView] Failed to load from localStorage:', e);
|
|
120
|
+
}
|
|
121
|
+
}, []);
|
|
122
|
+
|
|
123
|
+
return (
|
|
124
|
+
<div className="min-h-screen bg-neutral-50 dark:bg-neutral-900 p-8">
|
|
125
|
+
<div className="max-w-4xl mx-auto">
|
|
126
|
+
{/* Header */}
|
|
127
|
+
<div className="mb-8">
|
|
128
|
+
<h1 className="text-4xl font-black uppercase tracking-tighter text-neutral-950 dark:text-white mb-2">
|
|
129
|
+
Blog Plugin Settings
|
|
130
|
+
</h1>
|
|
131
|
+
<p className="text-sm text-neutral-600 dark:text-neutral-400">
|
|
132
|
+
Configure editor appearance and behavior. Changes are applied immediately.
|
|
133
|
+
</p>
|
|
134
|
+
</div>
|
|
135
|
+
|
|
136
|
+
{/* Settings Card */}
|
|
137
|
+
<div className="bg-white dark:bg-neutral-800 rounded-[2.5rem] border border-neutral-200 dark:border-neutral-700 shadow-lg p-8">
|
|
138
|
+
{/* Dark Mode Toggle */}
|
|
139
|
+
<div className="mb-8 pb-8 border-b border-neutral-200 dark:border-neutral-700">
|
|
140
|
+
<div className="flex items-center justify-between mb-4">
|
|
141
|
+
<div className="flex items-center gap-3">
|
|
142
|
+
{darkMode ? (
|
|
143
|
+
<Moon className="size-5 text-neutral-600 dark:text-neutral-400" />
|
|
144
|
+
) : (
|
|
145
|
+
<Sun className="size-5 text-neutral-600 dark:text-neutral-400" />
|
|
146
|
+
)}
|
|
147
|
+
<div>
|
|
148
|
+
<label className="text-sm font-black uppercase tracking-widest text-neutral-600 dark:text-neutral-400">
|
|
149
|
+
Dark Mode
|
|
150
|
+
</label>
|
|
151
|
+
<p className="text-xs text-neutral-500 dark:text-neutral-500 mt-1">
|
|
152
|
+
Enable dark mode for editor content area and wrappers
|
|
153
|
+
</p>
|
|
154
|
+
</div>
|
|
155
|
+
</div>
|
|
156
|
+
<button
|
|
157
|
+
onClick={() => setDarkMode(!darkMode)}
|
|
158
|
+
className={`relative inline-flex h-6 w-11 items-center rounded-full transition-colors ${
|
|
159
|
+
darkMode
|
|
160
|
+
? 'bg-primary'
|
|
161
|
+
: 'bg-neutral-300 dark:bg-neutral-600'
|
|
162
|
+
}`}
|
|
163
|
+
>
|
|
164
|
+
<span
|
|
165
|
+
className={`inline-block h-4 w-4 transform rounded-full bg-white transition-transform ${
|
|
166
|
+
darkMode ? 'translate-x-6' : 'translate-x-1'
|
|
167
|
+
}`}
|
|
168
|
+
/>
|
|
169
|
+
</button>
|
|
170
|
+
</div>
|
|
171
|
+
</div>
|
|
172
|
+
|
|
173
|
+
{/* Background Colors */}
|
|
174
|
+
<div className="mb-8">
|
|
175
|
+
<div className="flex items-center gap-3 mb-6">
|
|
176
|
+
<Palette className="size-5 text-neutral-600 dark:text-neutral-400" />
|
|
177
|
+
<div>
|
|
178
|
+
<label className="text-sm font-black uppercase tracking-widest text-neutral-600 dark:text-neutral-400">
|
|
179
|
+
Background Colors
|
|
180
|
+
</label>
|
|
181
|
+
<p className="text-xs text-neutral-500 dark:text-neutral-500 mt-1">
|
|
182
|
+
Set custom background colors for the editor canvas
|
|
183
|
+
</p>
|
|
184
|
+
</div>
|
|
185
|
+
</div>
|
|
186
|
+
|
|
187
|
+
<div className="space-y-4">
|
|
188
|
+
{/* Light Mode Background */}
|
|
189
|
+
<div>
|
|
190
|
+
<label className="block text-[10px] font-black uppercase tracking-widest text-neutral-500 dark:text-neutral-500 mb-2">
|
|
191
|
+
Light Mode Background <span className="text-red-500">*</span>
|
|
192
|
+
</label>
|
|
193
|
+
<div className="flex items-center gap-3">
|
|
194
|
+
<input
|
|
195
|
+
type="text"
|
|
196
|
+
value={lightBg}
|
|
197
|
+
onChange={(e) => setLightBg(e.target.value)}
|
|
198
|
+
placeholder="#ffffff"
|
|
199
|
+
className="flex-1 bg-dashboard-card border border-dashboard-border p-4 rounded-2xl text-sm font-bold outline-none focus:border-primary transition-all text-dashboard-text"
|
|
200
|
+
/>
|
|
201
|
+
<div
|
|
202
|
+
className="w-16 h-16 rounded-xl border-2 border-neutral-200 dark:border-neutral-700"
|
|
203
|
+
style={{ backgroundColor: lightBg }}
|
|
204
|
+
/>
|
|
205
|
+
</div>
|
|
206
|
+
<p className="text-xs text-neutral-400 dark:text-neutral-600 mt-1">
|
|
207
|
+
CSS color value (hex, rgb, or named color)
|
|
208
|
+
</p>
|
|
209
|
+
</div>
|
|
210
|
+
|
|
211
|
+
{/* Dark Mode Background */}
|
|
212
|
+
<div>
|
|
213
|
+
<label className="block text-[10px] font-black uppercase tracking-widest text-neutral-500 dark:text-neutral-500 mb-2">
|
|
214
|
+
Dark Mode Background <span className="text-neutral-400">(Optional)</span>
|
|
215
|
+
</label>
|
|
216
|
+
<div className="flex items-center gap-3">
|
|
217
|
+
<input
|
|
218
|
+
type="text"
|
|
219
|
+
value={darkBg}
|
|
220
|
+
onChange={(e) => setDarkBg(e.target.value)}
|
|
221
|
+
placeholder="#171717"
|
|
222
|
+
disabled={!darkMode}
|
|
223
|
+
className={`flex-1 bg-white dark:bg-neutral-900/50 border border-neutral-300 dark:border-neutral-700 p-4 rounded-2xl text-sm font-bold outline-none focus:border-primary transition-all dark:text-neutral-100 ${
|
|
224
|
+
!darkMode ? 'opacity-50 cursor-not-allowed' : ''
|
|
225
|
+
}`}
|
|
226
|
+
/>
|
|
227
|
+
<div
|
|
228
|
+
className={`w-16 h-16 rounded-xl border-2 border-neutral-200 dark:border-neutral-700 ${
|
|
229
|
+
!darkMode ? 'opacity-50' : ''
|
|
230
|
+
}`}
|
|
231
|
+
style={{ backgroundColor: darkBg }}
|
|
232
|
+
/>
|
|
233
|
+
</div>
|
|
234
|
+
<p className="text-xs text-neutral-400 dark:text-neutral-600 mt-1">
|
|
235
|
+
Only used when dark mode is enabled
|
|
236
|
+
</p>
|
|
237
|
+
</div>
|
|
238
|
+
</div>
|
|
239
|
+
</div>
|
|
240
|
+
|
|
241
|
+
{/* Preview */}
|
|
242
|
+
<div className="mb-8 p-6 bg-neutral-50 dark:bg-neutral-900/50 rounded-2xl border border-neutral-200 dark:border-neutral-700">
|
|
243
|
+
<label className="block text-[10px] font-black uppercase tracking-widest text-neutral-500 dark:text-neutral-500 mb-3">
|
|
244
|
+
Preview
|
|
245
|
+
</label>
|
|
246
|
+
<div
|
|
247
|
+
className="h-32 rounded-xl border-2 border-dashed border-neutral-300 dark:border-neutral-700 flex items-center justify-center"
|
|
248
|
+
style={{
|
|
249
|
+
backgroundColor: darkMode ? darkBg : lightBg,
|
|
250
|
+
}}
|
|
251
|
+
>
|
|
252
|
+
<span className="text-xs font-bold uppercase tracking-widest text-neutral-600 dark:text-neutral-400">
|
|
253
|
+
Editor Canvas Preview
|
|
254
|
+
</span>
|
|
255
|
+
</div>
|
|
256
|
+
</div>
|
|
257
|
+
|
|
258
|
+
{/* Actions */}
|
|
259
|
+
<div className="flex items-center justify-between pt-6 border-t border-neutral-200 dark:border-neutral-700">
|
|
260
|
+
<button
|
|
261
|
+
onClick={handleReset}
|
|
262
|
+
className="px-6 py-3 rounded-full border border-neutral-300 dark:border-neutral-700 bg-white dark:bg-neutral-900/50 text-sm font-black uppercase tracking-widest text-neutral-600 dark:text-neutral-400 hover:bg-neutral-50 dark:hover:bg-neutral-800 transition-colors flex items-center gap-2"
|
|
263
|
+
>
|
|
264
|
+
<RotateCcw className="size-4" />
|
|
265
|
+
Reset
|
|
266
|
+
</button>
|
|
267
|
+
<button
|
|
268
|
+
onClick={handleSave}
|
|
269
|
+
disabled={!hasChanges}
|
|
270
|
+
className={`px-6 py-3 rounded-full text-sm font-black uppercase tracking-widest transition-all flex items-center gap-2 ${
|
|
271
|
+
hasChanges
|
|
272
|
+
? 'bg-primary text-white hover:bg-primary/90 shadow-lg shadow-primary/20'
|
|
273
|
+
: 'bg-neutral-200 dark:bg-neutral-700 text-neutral-400 dark:text-neutral-600 cursor-not-allowed'
|
|
274
|
+
}`}
|
|
275
|
+
>
|
|
276
|
+
<Save className="size-4" />
|
|
277
|
+
{saved ? 'Saved!' : 'Save Changes'}
|
|
278
|
+
</button>
|
|
279
|
+
</div>
|
|
280
|
+
</div>
|
|
281
|
+
|
|
282
|
+
{/* Info Card */}
|
|
283
|
+
<div className="mt-6 bg-blue-50 dark:bg-blue-900/20 border border-blue-200 dark:border-blue-800 rounded-2xl p-6">
|
|
284
|
+
<h3 className="text-sm font-black uppercase tracking-widest text-blue-900 dark:text-blue-300 mb-2">
|
|
285
|
+
How It Works
|
|
286
|
+
</h3>
|
|
287
|
+
<ul className="text-xs text-blue-800 dark:text-blue-400 space-y-1 list-disc list-inside">
|
|
288
|
+
<li>Changes are saved to <code className="bg-blue-100 dark:bg-blue-900/50 px-1 rounded">window.__JHITS_PLUGIN_PROPS__</code> and localStorage</li>
|
|
289
|
+
<li>Configuration persists across page refreshes</li>
|
|
290
|
+
<li>To apply changes in the editor, navigate to a post editor page</li>
|
|
291
|
+
<li>For production, configure these settings in your client app's blog config file</li>
|
|
292
|
+
</ul>
|
|
293
|
+
</div>
|
|
294
|
+
</div>
|
|
295
|
+
</div>
|
|
296
|
+
);
|
|
297
|
+
}
|
|
298
|
+
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Slug & SEO Manager View
|
|
3
|
+
* URL and SEO metadata management
|
|
4
|
+
* Follows dashboard earth-tone design system
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
'use client';
|
|
8
|
+
|
|
9
|
+
import React from 'react';
|
|
10
|
+
import { Search, Link2, FileText } from 'lucide-react';
|
|
11
|
+
|
|
12
|
+
export interface SlugSEOManagerViewProps {
|
|
13
|
+
postId?: string;
|
|
14
|
+
siteId: string;
|
|
15
|
+
locale: string;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function SlugSEOManagerView({ postId, siteId, locale }: SlugSEOManagerViewProps) {
|
|
19
|
+
return (
|
|
20
|
+
<div className="h-full w-full bg-white dark:bg-neutral-900 p-8 overflow-y-auto">
|
|
21
|
+
<div className="max-w-4xl mx-auto">
|
|
22
|
+
<h1 className="text-3xl font-black text-neutral-950 dark:text-white uppercase tracking-tighter mb-2">
|
|
23
|
+
Slug & SEO Manager
|
|
24
|
+
</h1>
|
|
25
|
+
<p className="text-sm text-neutral-500 dark:text-neutral-400 mb-8">
|
|
26
|
+
{postId ? `Managing SEO for post: ${postId}` : 'Manage URL slugs and SEO metadata'}
|
|
27
|
+
</p>
|
|
28
|
+
|
|
29
|
+
<div className="space-y-6">
|
|
30
|
+
{/* Slug Editor */}
|
|
31
|
+
<div className="p-6 bg-neutral-100 dark:bg-neutral-800/50 rounded-[2.5rem] border border-neutral-300 dark:border-neutral-700">
|
|
32
|
+
<label className="block text-sm font-black text-neutral-950 dark:text-white uppercase tracking-tight mb-3">
|
|
33
|
+
URL Slug
|
|
34
|
+
</label>
|
|
35
|
+
<div className="flex items-center gap-3">
|
|
36
|
+
<Link2 className="text-neutral-400 size-5" />
|
|
37
|
+
<input
|
|
38
|
+
type="text"
|
|
39
|
+
placeholder="post-url-slug"
|
|
40
|
+
className="flex-1 px-4 py-3 bg-white dark:bg-neutral-900 border border-neutral-300 dark:border-neutral-700 rounded-2xl text-sm focus:ring-2 focus:ring-primary/20 focus:border-primary outline-none"
|
|
41
|
+
/>
|
|
42
|
+
</div>
|
|
43
|
+
<p className="text-xs text-neutral-500 dark:text-neutral-400 mt-2">
|
|
44
|
+
Collision detection will appear here
|
|
45
|
+
</p>
|
|
46
|
+
</div>
|
|
47
|
+
|
|
48
|
+
{/* SEO Preview */}
|
|
49
|
+
<div className="p-6 bg-neutral-100 dark:bg-neutral-800/50 rounded-[2.5rem] border border-neutral-300 dark:border-neutral-700">
|
|
50
|
+
<label className="block text-sm font-black text-neutral-950 dark:text-white uppercase tracking-tight mb-3">
|
|
51
|
+
Search Result Preview
|
|
52
|
+
</label>
|
|
53
|
+
<div className="bg-white dark:bg-neutral-900 rounded-2xl p-4 border border-neutral-300 dark:border-neutral-700">
|
|
54
|
+
<div className="flex items-center gap-2 mb-2">
|
|
55
|
+
<Search size={16} className="text-neutral-400" />
|
|
56
|
+
<span className="text-xs text-neutral-500">Google Search Result</span>
|
|
57
|
+
</div>
|
|
58
|
+
<div className="space-y-1">
|
|
59
|
+
<h3 className="text-lg text-blue-600 dark:text-blue-400 hover:underline cursor-pointer">
|
|
60
|
+
Post Title Will Appear Here
|
|
61
|
+
</h3>
|
|
62
|
+
<p className="text-sm text-green-700 dark:text-green-400">
|
|
63
|
+
https://example.com/blog/post-url-slug
|
|
64
|
+
</p>
|
|
65
|
+
<p className="text-sm text-neutral-600 dark:text-neutral-400">
|
|
66
|
+
Meta description will appear here. This is what users see in search results.
|
|
67
|
+
</p>
|
|
68
|
+
</div>
|
|
69
|
+
</div>
|
|
70
|
+
</div>
|
|
71
|
+
|
|
72
|
+
{/* Meta Description */}
|
|
73
|
+
<div className="p-6 bg-neutral-100 dark:bg-neutral-800/50 rounded-[2.5rem] border border-neutral-300 dark:border-neutral-700">
|
|
74
|
+
<label className="block text-sm font-black text-neutral-950 dark:text-white uppercase tracking-tight mb-3">
|
|
75
|
+
Meta Description
|
|
76
|
+
</label>
|
|
77
|
+
<div className="flex items-start gap-3">
|
|
78
|
+
<FileText className="text-neutral-400 size-5 mt-1" />
|
|
79
|
+
<textarea
|
|
80
|
+
placeholder="Enter meta description for search engines..."
|
|
81
|
+
rows={4}
|
|
82
|
+
className="flex-1 px-4 py-3 bg-white dark:bg-neutral-900 border border-neutral-300 dark:border-neutral-700 rounded-2xl text-sm focus:ring-2 focus:ring-primary/20 focus:border-primary outline-none resize-none"
|
|
83
|
+
/>
|
|
84
|
+
</div>
|
|
85
|
+
<p className="text-xs text-neutral-500 dark:text-neutral-400 mt-2">
|
|
86
|
+
0 / 160 characters
|
|
87
|
+
</p>
|
|
88
|
+
</div>
|
|
89
|
+
</div>
|
|
90
|
+
</div>
|
|
91
|
+
</div>
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|