linguabot commited on
Commit
4295a05
·
verified ·
1 Parent(s): efd8183

Upload folder using huggingface_hub

Browse files
client/src/pages/TutorialTasks.tsx CHANGED
@@ -414,13 +414,16 @@ const TutorialTasks: React.FC = () => {
414
 
415
  setTutorialTasks(sortedTasks);
416
 
417
- // Use translation brief from tasks or localStorage
418
- let translationBrief = null;
419
  if (tasks.length > 0) {
420
  translationBrief = tasks[0].translationBrief;
421
  } else {
422
  const briefKey = `translationBrief_week_${week}`;
423
- translationBrief = localStorage.getItem(briefKey);
 
 
 
424
  }
425
 
426
  const tutorialWeekData: TutorialWeek = {
@@ -1178,8 +1181,8 @@ const TutorialTasks: React.FC = () => {
1178
 
1179
  {!isWeekTransitioning && (
1180
  <>
1181
- {/* Translation Brief - Shown once at the top */}
1182
- {tutorialWeek && tutorialWeek.translationBrief ? (
1183
  <div className="bg-ui-panel rounded-lg p-6 mb-8 border border-ui-border shadow-sm">
1184
  <div className="flex items-center justify-between mb-4">
1185
  <div className="flex items-center space-x-3">
 
414
 
415
  setTutorialTasks(sortedTasks);
416
 
417
+ // Use translation brief from tasks; if none and no tasks, only fall back to localStorage for admins
418
+ let translationBrief = null as string | null;
419
  if (tasks.length > 0) {
420
  translationBrief = tasks[0].translationBrief;
421
  } else {
422
  const briefKey = `translationBrief_week_${week}`;
423
+ const viewMode = (localStorage.getItem('viewMode')||'auto');
424
+ const role = (JSON.parse(localStorage.getItem('user')||'{}').role);
425
+ const isAdminView = (viewMode !== 'student') && role === 'admin';
426
+ translationBrief = isAdminView ? localStorage.getItem(briefKey) : '';
427
  }
428
 
429
  const tutorialWeekData: TutorialWeek = {
 
1181
 
1182
  {!isWeekTransitioning && (
1183
  <>
1184
+ {/* Translation Brief - Shown once at the top (hidden for students when week is hidden) */}
1185
+ {tutorialWeek && tutorialWeek.translationBrief && (!isWeekHidden || (isWeekHidden && isAdmin)) ? (
1186
  <div className="bg-ui-panel rounded-lg p-6 mb-8 border border-ui-border shadow-sm">
1187
  <div className="flex items-center justify-between mb-4">
1188
  <div className="flex items-center space-x-3">
client/src/pages/WeeklyPractice.tsx CHANGED
@@ -886,10 +886,13 @@ const WeeklyPractice: React.FC = () => {
886
  };
887
  setWeeklyPracticeWeek(weeklyPracticeWeekData);
888
  } else {
889
- // No practices: still fetch brief
890
  try {
891
  const br = await api.get(`/api/search/weekly-practice/${selectedWeek}/brief`);
892
- setWeeklyPracticeWeek({ weekNumber: selectedWeek, translationBrief: br.data?.translationBrief || '', practices: [] });
 
 
 
893
  } catch {
894
  setWeeklyPracticeWeek(null);
895
  }
@@ -1509,8 +1512,8 @@ const WeeklyPractice: React.FC = () => {
1509
  </div>
1510
  )}
1511
 
1512
- {/* Translation Brief - Shown once at the top (standalone allowed) */}
1513
- {!isWeekTransitioning && weeklyPracticeWeek && weeklyPracticeWeek.translationBrief ? (
1514
  <div className="bg-ui-panel rounded-xl p-8 mb-8 border border-ui-border">
1515
  <div className="flex items-center justify-between mb-4">
1516
  <div className="flex items-center space-x-2">
 
886
  };
887
  setWeeklyPracticeWeek(weeklyPracticeWeekData);
888
  } else {
889
+ // No practices: still fetch brief, but do not surface brief for students when hidden (server already returns empty when hidden)
890
  try {
891
  const br = await api.get(`/api/search/weekly-practice/${selectedWeek}/brief`);
892
+ const viewMode = (localStorage.getItem('viewMode')||'auto');
893
+ const role = (JSON.parse(localStorage.getItem('user')||'{}').role);
894
+ const isAdminView = (viewMode !== 'student') && role === 'admin';
895
+ setWeeklyPracticeWeek({ weekNumber: selectedWeek, translationBrief: isAdminView ? (br.data?.translationBrief || '') : (br.data?.translationBrief || ''), practices: [] });
896
  } catch {
897
  setWeeklyPracticeWeek(null);
898
  }
 
1512
  </div>
1513
  )}
1514
 
1515
+ {/* Translation Brief - Shown once at the top (hidden for students when week is hidden) */}
1516
+ {!isWeekTransitioning && weeklyPracticeWeek && weeklyPracticeWeek.translationBrief && (isAdmin || !isWeekHidden) ? (
1517
  <div className="bg-ui-panel rounded-xl p-8 mb-8 border border-ui-border">
1518
  <div className="flex items-center justify-between mb-4">
1519
  <div className="flex items-center space-x-2">