feat: Derek/disable updating (#239)

* feat: first conditional change

* feat: update conditionally 2

* feat: xd
This commit is contained in:
2024-09-30 19:15:25 -05:00
committed by GitHub
parent 9eaff24cbb
commit 0ab83efd47
2 changed files with 31 additions and 27 deletions

View File

@@ -1,6 +1,6 @@
import { background } from '@shared/messages'; import { background } from '@shared/messages';
import { UserScheduleStore } from '@shared/storage/UserScheduleStore'; import { UserScheduleStore } from '@shared/storage/UserScheduleStore';
import { enableCourseStatusChips } from '@shared/util/experimental'; import { enableCourseRefreshing, enableCourseStatusChips } from '@shared/util/experimental';
import Divider from '@views/components/common/Divider'; import Divider from '@views/components/common/Divider';
import ExtensionRoot from '@views/components/common/ExtensionRoot/ExtensionRoot'; import ExtensionRoot from '@views/components/common/ExtensionRoot/ExtensionRoot';
import List from '@views/components/common/List'; import List from '@views/components/common/List';
@@ -116,23 +116,25 @@ export default function PopupMain(): JSX.Element {
</> </>
)} )}
</div> </div>
<div className='inline-flex items-center self-center gap-1'> {enableCourseRefreshing && (
<Text variant='mini' className='text-ut-gray !font-normal'> <div className='inline-flex items-center self-center gap-1'>
DATA LAST UPDATED: {getUpdatedAtDateTimeString(activeSchedule.updatedAt)} <Text variant='mini' className='text-ut-gray !font-normal'>
</Text> DATA LAST UPDATED: {getUpdatedAtDateTimeString(activeSchedule.updatedAt)}
<button </Text>
className='h-4 w-4 bg-transparent p-0 btn' <button
onClick={() => { className='h-4 w-4 bg-transparent p-0 btn'
setIsRefreshing(true); onClick={() => {
}} setIsRefreshing(true);
> }}
<RefreshIcon >
className={clsx('h-4 w-4 text-ut-black animate-duration-800', { <RefreshIcon
'animate-spin': isRefreshing, className={clsx('h-4 w-4 text-ut-black animate-duration-800', {
})} 'animate-spin': isRefreshing,
/> })}
</button> />
</div> </button>
</div>
)}
</div> </div>
</div> </div>
</ExtensionRoot> </ExtensionRoot>

View File

@@ -1,5 +1,5 @@
import { Status } from '@shared/types/Course'; import { Status } from '@shared/types/Course';
import { enableCourseStatusChips } from '@shared/util/experimental'; import { enableCourseRefreshing, enableCourseStatusChips } from '@shared/util/experimental';
import { Button } from '@views/components/common/Button'; import { Button } from '@views/components/common/Button';
import CourseStatus from '@views/components/common/CourseStatus'; import CourseStatus from '@views/components/common/CourseStatus';
import Divider from '@views/components/common/Divider'; import Divider from '@views/components/common/Divider';
@@ -51,14 +51,16 @@ export default function CalendarHeader({ onSidebarToggle }: CalendarHeaderProps)
totalHours={activeSchedule.hours} totalHours={activeSchedule.hours}
totalCourses={activeSchedule.courses.length} totalCourses={activeSchedule.courses.length}
/> />
<div className='flex items-center gap-1 screenshot:hidden'> {enableCourseRefreshing && (
<Text variant='mini' className='text-nowrap text-ut-gray font-normal!'> <div className='flex items-center gap-1 screenshot:hidden'>
DATA LAST UPDATED: {getUpdatedAtDateTimeString(activeSchedule.updatedAt)} <Text variant='mini' className='text-nowrap text-ut-gray font-normal!'>
</Text> DATA LAST UPDATED: {getUpdatedAtDateTimeString(activeSchedule.updatedAt)}
<button className='inline-block h-4 w-4 bg-transparent p-0 btn'> </Text>
<RefreshIcon className='h-4 w-4 animate-duration-800 text-ut-black' /> <button className='inline-block h-4 w-4 bg-transparent p-0 btn'>
</button> <RefreshIcon className='h-4 w-4 animate-duration-800 text-ut-black' />
</div> </button>
</div>
)}
</div> </div>
<div className='hidden flex-row items-center justify-end gap-6 screenshot:hidden lg:flex'> <div className='hidden flex-row items-center justify-end gap-6 screenshot:hidden lg:flex'>
{enableCourseStatusChips && ( {enableCourseStatusChips && (