Skip to content

Commit ac8edd7

Browse files
authored
D.T Home Screen Migration Into Core Theme (#2785)
* Add Home Screen Magic Link App functionality - Introduced a new Home Screen Magic Link App, including main loader and dashboard template. - Implemented CRUD operations for custom apps and training videos management. - Added admin interface for managing settings and content. - Integrated frontend styles and scripts for a responsive user experience. - Updated functions.php to load the new app components. - Created README documentation for usage and features. * Enhance Magic Link App functionality - Commented out debug logging in the magic link home app to reduce console clutter. - Enriched coded magic-link app URLs in the home apps class, ensuring proper URL generation for user-created apps. - Updated sorting logic to operate on the enriched app list instead of the original list. * Refactor code for consistency and readability - Standardized whitespace and formatting in various files, including the home loader, magic link app, admin settings, and training management classes. - Enhanced nonce verification by adding wp_unslash to ensure proper handling of submitted data. - Improved debug logging statements for better clarity and consistency in error messages. * Enhance nonce verification and clean up whitespace - Improved security by adding sanitize_text_field to nonce verification in admin form submissions for screen settings, app actions, and video actions. - Added nonce verification checks in the respective handler methods to ensure security before processing actions. - Removed unnecessary whitespace in the magic link home app and training class files for better code readability. * Refactor admin.js for improved readability and functionality - Enhanced the structure and formatting of the admin.js file for better consistency and clarity. - Streamlined event handler functions for managing app and video edits, including improved form handling and validation. - Added comments to clarify the purpose of functions and improve maintainability. - Ensured that required attributes are managed correctly when forms are shown or hidden. * Implement drag-and-drop reordering for apps and videos in admin interface - Added AJAX handlers for reordering apps and training videos, enhancing user experience with drag-and-drop functionality. - Updated the admin interface to support sortable tables, including visual feedback during drag operations. - Enhanced CSS styles for drag-and-drop elements to improve usability and responsiveness. - Refactored the reorder logic in the home apps and training classes to accommodate new ordering mechanism. - Introduced a new SortableTable class in admin.js to manage drag-and-drop interactions effectively. * Refactor admin.js for improved readability and consistency - Cleaned up whitespace and formatting throughout the admin.js file to enhance code clarity. - Standardized the structure of function calls and improved the readability of the drag-and-drop logic. - Ensured consistent use of arrow functions and improved the handling of drop indicators during drag operations. * Enhance icon management in admin interface - Added an icon selector dialog for easier icon selection in app forms. - Implemented live preview of selected icons in the app creation and editing forms. - Updated JavaScript to handle icon input changes and improve user experience. - Enhanced CSS styles for icon display and button interactions. - Refactored admin.js to streamline event handling for icon changes. * Refactor home-admin.php for improved script management - Cleaned up whitespace in the home-admin.php file for better readability. - Ensured proper enqueueing of scripts and styles, maintaining consistency in the admin interface. - Improved organization of script dependencies to enhance loading efficiency. * Implement role-based access control for apps - Added role-based access control features to the home screen app, allowing app access to be restricted based on user roles. - Introduced new settings in the admin interface to enable role-based permissions and select specific roles for app access. - Enhanced app management functions to support user role filtering when retrieving apps. - Created migration utilities to update existing apps with role fields and slugs for compatibility with the new system. - Updated JavaScript to handle role selection and visibility in the admin forms, improving user experience. * Refactor whitespace and enhance output sanitization in admin files - Cleaned up unnecessary whitespace in multiple files for improved code readability. - Updated output handling in home-admin.php to ensure proper sanitization of role counts displayed to users. - Maintained consistency in code formatting across class-home-apps.php, class-home-migration.php, and class-home-roles-permissions.php. * Implement theme toggle functionality and enhance styling support - Introduced a theme toggle feature allowing users to switch between light and dark modes. - Added JavaScript for theme management, including saving user preferences and applying styles dynamically. - Updated CSS to support theme variables and transitions for a smoother user experience. - Enhanced home screen layout with a dedicated area for the theme toggle button. - Incremented version numbers for related stylesheets and scripts to reflect changes. * Fix whitespace issue in magic-link-home-app.php for improved code readability * Enhance app color management in admin interface * Implement menu toggle and training view functionality - Added a menu toggle feature to enhance navigation on the home screen. - Introduced a new training view, allowing users to access training videos separately. - Updated JavaScript to manage menu interactions and refresh data dynamically. - Enhanced CSS for improved styling and responsiveness across different views. - Refactored home screen layout to accommodate new features and maintain consistency. * Refactor whitespace for improved code readability in magic-link-home-app.php and home-admin.php * Add launcher navigation and wrapper functionality for app-type magic links - Introduced a launcher bottom navigation bar for app-type magic link apps, enhancing user navigation. - Implemented a launcher wrapper page that loads target apps in an iframe when the launcher parameter is present in the URL. - Updated CSS to style the new launcher navigation and ensure compatibility with dark mode. - Added helper functions to generate magic URLs for coded apps and manage app navigation. - Refactored existing code to accommodate the new features and improve overall structure. * Refactor magic link app functionality and improve URL handling - Cleaned up whitespace for better code readability in magic-link-home-app.php. - Enhanced URL handling by sanitizing HTTP_HOST and REQUEST_URI to prevent potential issues. - Updated launcher navigation and wrapper functionality to ensure proper loading of target apps. - Improved error logging for better debugging and tracking of app-type pages. * Enhance magic link app functionality and UI - Added logout URL handling to the menu toggle script for improved user experience. - Updated CSS to set background styles to transparent for better visual consistency across themes. - Refactored JavaScript to manage app navigation and iframe requests more effectively. - Introduced helper functions for generating logout URLs and detecting iframe requests. - Improved error logging for better debugging and tracking of app-type pages. * Refactor launcher navigation registration in magic link app - Introduced a method to conditionally register launcher hooks based on the presence of a launcher query parameter or when viewing the home screen app. - Improved code organization and readability by encapsulating launcher hook logic in a dedicated function. * Update magic link app styles and functionality - Bumped version of home screen CSS to 1.0.19 for improved styling. - Enhanced responsiveness of the home screen container with new media queries for better readability on different devices. - Updated app card and icon styles for consistency and improved visual appeal. - Implemented theme-aware icon color handling in both admin and frontend, ensuring proper color display based on user preferences. - Refactored JavaScript to apply theme-aware colors dynamically and maintain custom colors for icons. - Migrated old app data structure to new format, ensuring compatibility with the updated theme. * Refactor whitespace and improve code readability in migration and admin files - Cleaned up whitespace in home-admin.php for better readability. - Standardized formatting in migration file 0062 to enhance code clarity. - Ensured consistent spacing throughout the codebase to improve maintainability. * Remove unnecessary comments in migration file 0062 to streamline code and enhance clarity. * Refactor magic link app and launcher functionality - Updated root and type properties in the magic link home app to align with new structure. - Enhanced URL handling in the launcher bottom navigation to prioritize magic keys and improve fallback logic. - Removed default sample apps and videos initialization for a cleaner setup. - Improved magic URL generation for user and template post types, ensuring better handling of magic keys. - Streamlined migration process by deactivating the old plugin to prevent conflicts with the new implementation. * Refactor URL handling in launcher bottom navigation and migration file - Updated variable names for clarity in the launcher bottom navigation to improve code readability. - Removed unnecessary whitespace in the migration file to streamline the code. - Enhanced URL parsing logic to ensure consistent handling of app URLs. * Add login modal functionality and styles to magic link home app - Implemented a login modal for unauthenticated users, enhancing user experience by prompting for login when necessary. - Added translations for login-related text to support multiple languages. - Introduced JavaScript functions to handle login form submission and error display. - Updated CSS to style the login modal, ensuring responsiveness and theme compatibility. - Refactored existing JavaScript to check authentication before loading app content, improving security and flow. - Enhanced error handling for login failures to provide clearer feedback to users. * Update loading spinner styles and remove console logs for cleaner code - Increased loading spinner size for better visibility and updated border color for improved aesthetics. - Refactored loading card structure in frontend files to enhance layout consistency. - Removed unnecessary console log statements across various JavaScript files to streamline code and reduce clutter. * change primary color * Enhance app icon handling and styling in home app - Added responsive styles for app icons, ensuring images fit within their containers and maintain aspect ratios. - Updated background color and border styles for app cards to improve visual consistency. - Introduced a new method to load home apps, separating them from magic link apps for better organization. - Enhanced icon rendering logic to support both image and icon class types, improving flexibility in app display. * Add user invitation and login requirements settings in home admin - Introduced settings to allow users to invite others and require login for accessing the home screen. - Updated the admin interface to include checkboxes for these new settings, with appropriate descriptions. - Enhanced form handling to ensure these settings are saved correctly and integrated into existing functionality. - Added JavaScript to manage the submission of these new settings in the admin form. - Implemented backend functions to check if user invitations and login requirements are enabled. * Refactor settings handling in home admin - Cleaned up whitespace in the handle_settings_save method for improved readability. - Ensured consistent formatting throughout the method to enhance code maintainability. - No functional changes were made; this commit focuses solely on code style improvements. * Enhance theme-aware color handling and app card styles - Updated CSS for dark mode to improve specificity and maintainability, consolidating selectors for app cards and other elements. - Refactored JavaScript to handle color reset functionality for app forms, ensuring proper updates to descriptions based on user input. - Improved app color handling in the backend to use empty strings for no custom color, preserving options in WordPress. - Added theme-aware icon color application for launcher navigation, ensuring consistent styling across different components. - Removed redundant CSS rules and moved component styles to dedicated CSS files for better organization. * Refactor whitespace and improve color handling in home admin and launcher navigation - Cleaned up whitespace in the home admin file for better readability. - Enhanced color handling logic to ensure proper updates and prevent unnecessary color changes. - Improved custom color checks in the launcher navigation to align with backend logic. - Updated HTML attributes to use wp_kses for better security and consistency. * Refactor app handling and improve coded app management - Enhanced the logic for managing coded apps, ensuring that only customization fields are saved for these apps. - Updated the app retrieval and update methods to better handle coded app customizations, merging them with their base app data. - Improved the admin interface to reflect the read-only nature of certain fields for coded apps, providing clear user feedback. - Refactored CSS for better specificity and maintainability across various components, ensuring consistent styling. - Cleaned up whitespace and improved code readability throughout the affected files. * Refactor conditional logic for coded app management in home apps class - Improved readability of the conditional statement that checks for coded app IDs and creation types. - Ensured consistent handling of app customizations by refining the merging logic with coded app data. * Refactor home app styles and menu toggle functionality - Updated JavaScript to ensure the current view is accurately retrieved and managed, improving the handling of active menu items. - Refactored CSS to enhance specificity and maintainability, including a minimal CSS reset for better styling consistency. - Adjusted styles for app cards and launcher navigation to ensure proper theme support and responsiveness. - Cleaned up whitespace and improved code readability across affected files. * Refactor menu toggle JavaScript for improved readability - Cleaned up whitespace in the menu toggle script to enhance code clarity. - Improved the focus logic for active menu items, ensuring better accessibility for keyboard users. * Refactor whitespace in magic link home app for improved readability - Cleaned up unnecessary whitespace in the JavaScript and CSS arrays to enhance code clarity. - No functional changes were made; this commit focuses solely on code style improvements. * Consolidate dark mode styles for improved maintainability - Merged multiple dark mode header and text color styles into consolidated selectors for better readability and maintainability. - Removed redundant CSS rules related to theme-aware menu item colors, as they are already covered by existing styles. - Enhanced overall theme support by streamlining color handling across various components. * Refactor styles and improve structure for home screen components - Moved various inline styles from the magic link home app to the external home-screen.css for better organization and maintainability. - Updated class names in the JavaScript for training video cards to align with the new CSS structure. - Enhanced the launcher bottom navigation to ensure proper visibility and responsiveness, including a dummy spacer for layout consistency. - Consolidated dark mode styles and improved specificity across components for a more cohesive theme experience. * Refactor launcher navigation and improve dark mode styles - Updated class names in the launcher navigation to use consistent 'dt-' prefixes, enhancing clarity and maintainability. - Consolidated dark mode styles for various components, ensuring a cohesive theme experience across the application. - Improved CSS variable usage for better theme support and responsiveness in the launcher bottom navigation and app selector. - Cleaned up JavaScript to align with the new class structure, enhancing readability and maintainability. * Refactor magic link home app and consolidate styles into home-screen.css - Moved all inline styles from the magic link home app to home-screen.css for improved organization and maintainability. - Removed unused JavaScript functions related to video handling, streamlining the codebase. - Updated dark mode styles for links and other components to enhance theme consistency. - Cleaned up the JavaScript logic for section toggling and theme initialization, improving readability and performance. - Enhanced CSS variable usage for better theme support across the application.
1 parent 94058f9 commit ac8edd7

22 files changed

Lines changed: 11341 additions & 2 deletions

dt-apps/dt-home/README.md

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
# DT Home Screen Magic Link App
2+
3+
## Overview
4+
5+
This is a self-contained magic link app for the Disciple.Tools theme that provides a Home Screen dashboard functionality. It replaces the functionality previously provided by the `@dt-home/` plugin, but is now integrated directly into the theme.
6+
7+
## Structure
8+
9+
```
10+
dt-apps/dt-home/
11+
├── magic-link-home-app.php # Main magic link app class
12+
├── dt-home-loader.php # Main loader file
13+
├── admin/
14+
│ └── home-admin.php # Admin interface (hooks into theme settings)
15+
├── frontend/
16+
│ └── home-screen.php # Main dashboard template
17+
├── assets/
18+
│ ├── css/
19+
│ │ ├── home-screen.css # Frontend styles
20+
│ │ └── admin.css # Admin styles
21+
│ └── js/
22+
│ ├── home-screen.js # Frontend JavaScript
23+
│ └── admin.js # Admin JavaScript
24+
└── includes/ # Additional classes (future phases)
25+
```
26+
27+
## Features (Phase 1)
28+
29+
### ✅ Completed
30+
- **Magic Link App Structure** - Follows the existing theme pattern
31+
- **Home Screen Dashboard** - Basic frontend interface
32+
- **Admin Integration** - Hooks into theme settings as a new tab
33+
- **Responsive Design** - Mobile-friendly layout
34+
- **Theme Integration** - Loaded via theme's functions.php
35+
36+
### 🔄 Future Phases
37+
- **Apps Management** - CRUD for custom apps
38+
- **Training Videos** - Video management and display
39+
- **User Authentication** - Enhanced login/logout
40+
- **Settings Management** - Advanced configuration options
41+
42+
## Usage
43+
44+
### For Users
45+
1. Navigate to your user settings in Disciple.Tools
46+
2. Find the "Home Screen" app in your apps list
47+
3. Click to generate your magic link
48+
4. Access your personalized dashboard
49+
50+
### For Administrators
51+
1. Go to Settings (D.T) in the WordPress admin
52+
2. Click on the "Home Screen" tab (or use the direct submenu item)
53+
3. Configure general settings, apps, and training videos
54+
55+
## How to Test Phase 1
56+
57+
### Admin Interface Testing
58+
1. **Direct Access**: Go to Settings (D.T) → Home Screen (submenu item)
59+
2. **Tab Navigation**: Go to Settings (D.T) → click "Home Screen" tab
60+
3. **Settings Form**: Test saving general settings (title, description, training videos toggle)
61+
4. **Form Validation**: Try submitting empty title to test validation
62+
63+
### Magic Link Testing
64+
1. **User Settings**: Go to user profile → Your Apps section
65+
2. **App Generation**: Look for "Home Screen" app in the list
66+
3. **Magic Link**: Click to generate/copy the magic link
67+
4. **Frontend Access**: Visit the generated magic link URL
68+
5. **Dashboard Display**: Verify the home screen loads with placeholder content
69+
70+
### Frontend Testing
71+
1. **Responsive Design**: Test on mobile/tablet/desktop
72+
2. **Loading States**: Check loading spinners work
73+
3. **Quick Actions**: Test Settings and Logout buttons
74+
4. **Error Handling**: Verify error messages display properly
75+
76+
## Development
77+
78+
This app follows the established pattern for magic link apps in the Disciple.Tools theme:
79+
80+
1. **Magic Link Class** - Extends `DT_Magic_Url_Base`
81+
2. **REST Endpoints** - Uses WordPress REST API
82+
3. **Admin Integration** - Hooks into theme settings system
83+
4. **Frontend Templates** - PHP templates with WordPress standards
84+
5. **Asset Management** - Uses WordPress enqueue system
85+
86+
## Integration Points
87+
88+
- **Theme Settings**: `dt_settings_tab_menu` and `dt_settings_tab_content` hooks
89+
- **Magic Link System**: Standard magic link registration
90+
- **User Management**: Integrates with existing user system
91+
- **Asset Loading**: Uses theme's asset management system
92+
93+
## Future Development
94+
95+
This structure provides a clean pattern for future magic link apps:
96+
97+
1. Create new directory under `dt-apps/`
98+
2. Follow the same structure
99+
3. Add loader to `functions.php`
100+
4. Hook into theme systems as needed
101+
102+
## Phase 2 Status: ✅ COMPLETE
103+
104+
### ✅ Phase 2 Completed Features
105+
- **Apps Management** - Full CRUD operations for custom apps
106+
- **Training Videos** - Full CRUD operations for training videos
107+
- **Admin Interface** - Complete management interface
108+
- **Frontend Display** - Real apps and videos display
109+
- **Data Persistence** - WordPress options API storage
110+
- **Validation** - Input validation and error handling
111+
112+
## How to Test Phase 2
113+
114+
### Admin Interface Testing
115+
1. **Apps Management**:
116+
- Go to Settings (D.T) → Home Screen
117+
- Test creating new apps with different settings
118+
- Test editing existing apps
119+
- Test deleting apps
120+
- Verify apps appear in the list with correct information
121+
122+
2. **Training Videos Management**:
123+
- Test creating new training videos with YouTube URLs
124+
- Test editing video details (title, description, duration, category)
125+
- Test deleting videos
126+
- Verify videos appear in the list with thumbnails
127+
128+
3. **Form Validation**:
129+
- Try submitting empty required fields
130+
- Test invalid URLs
131+
- Verify error messages display properly
132+
133+
### Frontend Testing
134+
1. **Real Data Display**:
135+
- Generate a magic link from user settings
136+
- Visit the magic link URL
137+
- Verify real apps and videos load (not placeholders)
138+
- Test clicking on apps and videos (should open in new tab)
139+
140+
2. **Dynamic Content**:
141+
- Add new apps/videos in admin
142+
- Refresh the frontend to see changes
143+
- Test with different app colors and icons
144+
145+
3. **Error Handling**:
146+
- Test with no apps/videos configured
147+
- Verify appropriate "no content" messages
148+
149+
### Data Persistence Testing
150+
1. **Settings Persistence**:
151+
- Change general settings and save
152+
- Refresh page to verify settings persist
153+
- Test enabling/disabling training videos
154+
155+
2. **Content Persistence**:
156+
- Add apps and videos
157+
- Refresh admin page to verify they persist
158+
- Test editing and verify changes save
159+
160+
## Phase 1 Status: ✅ COMPLETE
161+
## Phase 2 Status: ✅ COMPLETE
162+
163+
The core functionality is now complete. Ready for Phase 3 development (enhanced features).

0 commit comments

Comments
 (0)