maintenance: Clean up comments throughout component files
This commit is contained in:
@@ -27,8 +27,10 @@ const PostCard = ({ post, onEdit }) => {
|
|||||||
|
|
||||||
const formattedDate = date.toLocaleDateString(undefined, dateOptions);
|
const formattedDate = date.toLocaleDateString(undefined, dateOptions);
|
||||||
|
|
||||||
|
// Split formatted date to check if time component exists
|
||||||
const parts = formattedDate.split(',');
|
const parts = formattedDate.split(',');
|
||||||
if (parts.length > 1) {
|
if (parts.length > 1) {
|
||||||
|
// Reconstruct with separate date and time formatting for consistency
|
||||||
const timePart = date.toLocaleTimeString(undefined, { hour: 'numeric', minute: '2-digit', hour12: true });
|
const timePart = date.toLocaleTimeString(undefined, { hour: 'numeric', minute: '2-digit', hour12: true });
|
||||||
const datePart = date.toLocaleDateString(undefined, { year: 'numeric', month: 'short', day: 'numeric' });
|
const datePart = date.toLocaleDateString(undefined, { year: 'numeric', month: 'short', day: 'numeric' });
|
||||||
return `${datePart}, ${timePart}`;
|
return `${datePart}, ${timePart}`;
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
// MarkdownEditor.jsx
|
// MarkdownEditor.jsx
|
||||||
// KendoReact Splitter implementation for dual-pane markdown editing with live preview
|
// KendoReact Splitter implementation for dual-pane markdown editing with live preview
|
||||||
// Demonstrates advanced layout components and real-time markdown processing
|
|
||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { Splitter, SplitterPane } from '@progress/kendo-react-layout';
|
import { Splitter, SplitterPane } from '@progress/kendo-react-layout';
|
||||||
import { marked } from 'marked';
|
import { marked } from 'marked';
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
// WysiwygEditor.jsx
|
// WysiwygEditor.jsx
|
||||||
// KendoReact Editor implementation for HTML editing with custom toolbar
|
// KendoReact Editor implementation for HTML editing with custom toolbar
|
||||||
// Demonstrates custom tool integration and advanced editor configuration
|
|
||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { Editor, EditorTools, EditorToolsSettings } from '@progress/kendo-react-editor';
|
import { Editor, EditorTools, EditorToolsSettings } from '@progress/kendo-react-editor';
|
||||||
import InlineCodeTool from './custom/InlineCodeTool';
|
import InlineCodeTool from './custom/InlineCodeTool';
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
// EditorModeToggle.jsx
|
// EditorModeToggle.jsx
|
||||||
// Custom KendoReact component for switching between HTML and Markdown editing modes
|
// Custom KendoReact component for switching between HTML and Markdown editing modes
|
||||||
// Demonstrates reusable UI components and state management patterns
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { Button } from '@progress/kendo-react-buttons';
|
import { Button } from '@progress/kendo-react-buttons';
|
||||||
|
|
||||||
|
@@ -21,14 +21,14 @@ const InlineCodeTool = (props) => {
|
|||||||
const hasMark = state.doc.rangeHasMark(from, to, markType);
|
const hasMark = state.doc.rangeHasMark(from, to, markType);
|
||||||
|
|
||||||
if (hasMark) {
|
if (hasMark) {
|
||||||
// Remove code mark if already present
|
// Remove code mark if already present (toggle off)
|
||||||
tr.removeMark(from, to, markType);
|
tr.removeMark(from, to, markType);
|
||||||
} else {
|
} else {
|
||||||
// Add code mark to selected text
|
// Add code mark to selected text (toggle on)
|
||||||
tr.addMark(from, to, markType.create());
|
tr.addMark(from, to, markType.create());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Dispatch transaction to apply changes
|
// Dispatch transaction to apply changes to editor
|
||||||
dispatch(tr);
|
dispatch(tr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -24,6 +24,7 @@ const LoginComponent = ({ onLogin }) => {
|
|||||||
} else {
|
} else {
|
||||||
console.error("Invalid username or password");
|
console.error("Invalid username or password");
|
||||||
setError("Invalid username or password. Please try again.");
|
setError("Invalid username or password. Please try again.");
|
||||||
|
// Clear error after 50 seconds (long timeout for demo purposes)
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
setError('');
|
setError('');
|
||||||
}, 50000);
|
}, 50000);
|
||||||
|
@@ -35,7 +35,7 @@ const CampfirePanelBar = ({ isExpanded = true }) => {
|
|||||||
const navigate = useNavigate();
|
const navigate = useNavigate();
|
||||||
|
|
||||||
const renderItem = (item) => {
|
const renderItem = (item) => {
|
||||||
// External links
|
// Handle external links (open in new tab)
|
||||||
if (item.url) {
|
if (item.url) {
|
||||||
return (
|
return (
|
||||||
<PanelBarItem
|
<PanelBarItem
|
||||||
@@ -79,7 +79,7 @@ const CampfirePanelBar = ({ isExpanded = true }) => {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Internal routes
|
// Handle internal routes (navigate within app)
|
||||||
if (item.route) {
|
if (item.route) {
|
||||||
return (
|
return (
|
||||||
<PanelBarItem
|
<PanelBarItem
|
||||||
@@ -106,7 +106,7 @@ const CampfirePanelBar = ({ isExpanded = true }) => {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Headers with children
|
// Handle section headers with child items
|
||||||
return (
|
return (
|
||||||
<PanelBarItem
|
<PanelBarItem
|
||||||
key={item.title}
|
key={item.title}
|
||||||
|
@@ -10,10 +10,12 @@ const CampfireBreadcrumb = () => {
|
|||||||
const path = location.pathname;
|
const path = location.pathname;
|
||||||
const pathSegments = path.split('/').filter(segment => segment);
|
const pathSegments = path.split('/').filter(segment => segment);
|
||||||
|
|
||||||
|
// Dashboard routes
|
||||||
if (path === '/dashboard' || path === '/') {
|
if (path === '/dashboard' || path === '/') {
|
||||||
return [{ id: 'dashboard', text: 'Dashboard' }];
|
return [{ id: 'dashboard', text: 'Dashboard' }];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Published posts filter
|
||||||
if (path === '/posts') {
|
if (path === '/posts') {
|
||||||
return [
|
return [
|
||||||
{ id: 'dashboard', text: 'Dashboard' },
|
{ id: 'dashboard', text: 'Dashboard' },
|
||||||
@@ -21,6 +23,7 @@ const CampfireBreadcrumb = () => {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Drafts filter
|
||||||
if (path === '/drafts') {
|
if (path === '/drafts') {
|
||||||
return [
|
return [
|
||||||
{ id: 'dashboard', text: 'Dashboard' },
|
{ id: 'dashboard', text: 'Dashboard' },
|
||||||
@@ -28,6 +31,7 @@ const CampfireBreadcrumb = () => {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// New post editor
|
||||||
if (path === '/editor') {
|
if (path === '/editor') {
|
||||||
return [
|
return [
|
||||||
{ id: 'editor', text: 'Editor' },
|
{ id: 'editor', text: 'Editor' },
|
||||||
@@ -35,6 +39,7 @@ const CampfireBreadcrumb = () => {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Edit existing post
|
||||||
if (path.startsWith('/editor/')) {
|
if (path.startsWith('/editor/')) {
|
||||||
const slug = pathSegments[1];
|
const slug = pathSegments[1];
|
||||||
return [
|
return [
|
||||||
@@ -43,6 +48,7 @@ const CampfireBreadcrumb = () => {
|
|||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Default fallback
|
||||||
return [{ id: 'dashboard', text: 'Dashboard' }];
|
return [{ id: 'dashboard', text: 'Dashboard' }];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@@ -18,6 +18,7 @@ export default function Copyright({ isLoginPage, isLoggedIn }) {
|
|||||||
}, [isLoginPage]);
|
}, [isLoginPage]);
|
||||||
|
|
||||||
// Show copyright on login page with transition, or at bottom after login
|
// Show copyright on login page with transition, or at bottom after login
|
||||||
|
// Hide completely when not on login page and not logged in
|
||||||
if (!isLoginPage && !isLoggedIn) {
|
if (!isLoginPage && !isLoggedIn) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@@ -48,6 +48,7 @@ const Dashboard = React.forwardRef((props, ref) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const filter = getFilterFromPath();
|
const filter = getFilterFromPath();
|
||||||
|
// Show sections based on URL filter or show both if no filter
|
||||||
const showPublished = !filter || filter === 'published';
|
const showPublished = !filter || filter === 'published';
|
||||||
const showDrafts = !filter || filter === 'drafts';
|
const showDrafts = !filter || filter === 'drafts';
|
||||||
|
|
||||||
|
@@ -79,7 +79,7 @@ const EditorPage = React.forwardRef((props, ref) => {
|
|||||||
if (editMode === 'html') {
|
if (editMode === 'html') {
|
||||||
// Switch to markdown mode - keep the existing markdown content
|
// Switch to markdown mode - keep the existing markdown content
|
||||||
setEditMode('markdown');
|
setEditMode('markdown');
|
||||||
// Reset splitter to 50/50
|
// Reset splitter to 50/50 for markdown editor
|
||||||
setPanes([
|
setPanes([
|
||||||
{ size: '50%' },
|
{ size: '50%' },
|
||||||
{}
|
{}
|
||||||
|
Reference in New Issue
Block a user