@@ -60,13 +58,12 @@ export function VideoGrid({
return (
-
+
{videos.map(video => (
!disabled && onVideoClick(video.id)}
- disabled={disabled}
+ onClick={() => onVideoClick(video.id)}
/>
))}
diff --git a/frontend/src/components/VideoPlayer/VideoPlayer.tsx b/frontend/src/components/VideoPlayer/VideoPlayer.tsx
index 86e2c95..b53a915 100644
--- a/frontend/src/components/VideoPlayer/VideoPlayer.tsx
+++ b/frontend/src/components/VideoPlayer/VideoPlayer.tsx
@@ -1,5 +1,4 @@
import { useEffect, useRef } from 'react';
-import { useTimeLimit } from '../../hooks/useTimeLimit';
import { setCurrentVideo } from '../../services/connectionTracker';
interface VideoPlayerProps {
@@ -10,9 +9,7 @@ interface VideoPlayerProps {
}
export function VideoPlayer({ videoId, videoTitle, channelName, onClose }: VideoPlayerProps) {
- const { limitReached, startTracking, stopTracking, remainingTime } = useTimeLimit();
const iframeRef = useRef
(null);
- const checkLimitIntervalRef = useRef(null);
useEffect(() => {
// Set video info for connection tracking
@@ -24,56 +21,21 @@ export function VideoPlayer({ videoId, videoTitle, channelName, onClose }: Video
// Handle Escape key
const handleEscape = (e: KeyboardEvent) => {
if (e.key === 'Escape') {
- stopTracking();
setCurrentVideo(null);
onClose();
}
};
window.addEventListener('keydown', handleEscape);
- // Start tracking time when player opens
- if (!limitReached) {
- startTracking();
- }
-
- // Check limit periodically and stop video if reached
- checkLimitIntervalRef.current = setInterval(() => {
- if (limitReached && iframeRef.current) {
- // Stop the video by removing autoplay and reloading with paused state
- if (iframeRef.current.src.includes('autoplay=1')) {
- iframeRef.current.src = iframeRef.current.src.replace('autoplay=1', 'autoplay=0');
- }
- stopTracking();
- setCurrentVideo(null);
- }
- }, 1000);
-
return () => {
// Clear video info when player closes
setCurrentVideo(null);
document.body.style.overflow = 'unset';
window.removeEventListener('keydown', handleEscape);
- stopTracking();
- if (checkLimitIntervalRef.current) {
- clearInterval(checkLimitIntervalRef.current);
- }
};
- }, [videoId, videoTitle, channelName, onClose, limitReached, startTracking, stopTracking]);
-
- // Stop video immediately if limit reached
- useEffect(() => {
- if (limitReached && iframeRef.current) {
- // Change iframe src to stop autoplay
- const currentSrc = iframeRef.current.src;
- if (currentSrc.includes('autoplay=1')) {
- iframeRef.current.src = currentSrc.replace('autoplay=1', 'autoplay=0');
- }
- stopTracking();
- }
- }, [limitReached, stopTracking]);
+ }, [videoId, videoTitle, channelName, onClose]);
const handleClose = () => {
- stopTracking();
setCurrentVideo(null);
onClose();
};
@@ -93,38 +55,18 @@ export function VideoPlayer({ videoId, videoTitle, channelName, onClose }: Video
>
×
- {limitReached ? (
-
-
Daily Time Limit Reached
-
- You've reached your daily video watching limit. Come back tomorrow!
-
-
-
- ) : (
- <>
-
- {Math.floor(remainingTime)} min remaining today
-
-
-
-
- >
- )}
+
+
+
);
diff --git a/frontend/src/pages/AdminPage.tsx b/frontend/src/pages/AdminPage.tsx
index c05da80..75b061f 100644
--- a/frontend/src/pages/AdminPage.tsx
+++ b/frontend/src/pages/AdminPage.tsx
@@ -26,7 +26,7 @@ export function AdminPage() {
- Manage YouTube channels and video time limits
+ Manage YouTube channels
diff --git a/frontend/src/pages/SettingsProfilesAdminPage.tsx b/frontend/src/pages/SettingsProfilesAdminPage.tsx
index 03ff1ef..c525e50 100644
--- a/frontend/src/pages/SettingsProfilesAdminPage.tsx
+++ b/frontend/src/pages/SettingsProfilesAdminPage.tsx
@@ -75,13 +75,6 @@ export function SettingsProfilesAdminPage() {
return new Date(dateString).toLocaleDateString();
};
- const formatTime = (minutes: number | null) => {
- if (!minutes) return 'Not set';
- if (minutes < 60) return `${minutes} min`;
- const hours = Math.floor(minutes / 60);
- const mins = minutes % 60;
- return mins > 0 ? `${hours}h ${mins}m` : `${hours}h`;
- };
if (loading) {
return (
@@ -140,7 +133,6 @@ export function SettingsProfilesAdminPage() {
| Name |
Magic Code |
- Time Limit |
Enabled Apps |
Status |
Created |
@@ -165,9 +157,6 @@ export function SettingsProfilesAdminPage() {
-
- {formatTime(profile.dailyTimeLimit)}
- |
{profile.enabledApps && profile.enabledApps.length > 0 ? (
@@ -259,7 +248,6 @@ function SettingsProfileFormModal({
}) {
const [name, setName] = useState(profile?.name || '');
const [description, setDescription] = useState(profile?.description || '');
- const [dailyTimeLimit, setDailyTimeLimit] = useState(profile?.dailyTimeLimit?.toString() || '30');
// Default enabled apps: speechsounds and tictactoe (videos is disabled by default)
const defaultEnabledApps = APPS.filter(app => !app.disabled && app.id !== 'videos').map(app => app.id);
const [enabledApps, setEnabledApps] = useState(profile?.enabledApps ?? defaultEnabledApps);
@@ -283,21 +271,15 @@ function SettingsProfileFormModal({
return;
}
- const limit = parseInt(dailyTimeLimit, 10);
- if (isNaN(limit) || limit < 1) {
- setError('Daily time limit must be at least 1 minute');
- return;
- }
-
try {
setLoading(true);
if (profile) {
// Update existing profile
await settingsProfilesApi.update(profile.id, { name, description });
- await settingsProfilesApi.updateSettings(profile.id, { dailyTimeLimit: limit, enabledApps });
+ await settingsProfilesApi.updateSettings(profile.id, { enabledApps });
} else {
// Create new profile
- await settingsProfilesApi.create({ name, description, dailyTimeLimit: limit, enabledApps });
+ await settingsProfilesApi.create({ name, description, enabledApps });
}
onSuccess();
} catch (err: any) {
@@ -342,23 +324,6 @@ function SettingsProfileFormModal({
/>
-
-
- setDailyTimeLimit(e.target.value)}
- className="w-full px-4 py-2 border border-border rounded-lg bg-background text-foreground focus:outline-none focus:ring-2 focus:ring-primary"
- required
- />
-
- Maximum minutes per day children can watch videos
-
-
-
|