Skip to content

Commit

Permalink
fix: add tooltip to make users aware of disabled favorited content
Browse files Browse the repository at this point in the history
* feat: add in progress to user my progress page and remove activity chart

* fix: add tooltip to make users aware of disabled favorited content

* fix: prevent cron scheduler from updating provider relation, fix bottom margin on OI

---------

Co-authored-by: Richard Salas <rich@unlockedlabs.org>
Co-authored-by: PThorpe92 <preston@unlockedlabs.org>
  • Loading branch information
3 people authored Dec 12, 2024
1 parent e29d430 commit 3138feb
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 33 deletions.
2 changes: 1 addition & 1 deletion backend/tasks/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ func (jr *JobRunner) runTask(task *models.RunnableTask) {
return
}
task.Status = models.StatusRunning
if err := jr.db.Save(task).Error; err != nil {
if err := jr.db.Model(&models.RunnableTask{}).Where("id = ?", task.ID).Update("status", models.StatusRunning).Error; err != nil {
log.Errorf("failed to update task status: %v", err)
return
}
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/Components/FavoriteCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ const FavoriteCard: React.FC<FavoriteCardProps> = ({
favorite.visibility_status
? 'bg-grey-2 cursor-not-allowed'
: 'bg-inner-background cursor-pointer'
}`}
} tooltip `}
data-tip={favorite.visibility_status ? 'Unavailable Content' : ''}
onClick={favorite.visibility_status ? undefined : handleCardClick}
>
{!isAdminInStudentView && (
Expand Down
51 changes: 25 additions & 26 deletions frontend/src/Components/LibraryCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,32 +74,31 @@ export default function LibraryCard({
</figure>
<h3 className="w-3/4 body my-auto mr-7">{library.title}</h3>
</div>
{role != UserRole.Student && (
<div
className="absolute right-2 top-2 z-100"
onClick={(e) => void toggleLibraryFavorite(e)}
>
{/* don't display the favorite toggle when admin is viewing in student view*/}
<ULIComponent
tooltipClassName="absolute right-2 top-2 z-100"
iconClassName={`w-6 h-6 ${library.favorites.length > 0 && 'text-primary-yellow'}`}
icon={
AdminRoles.includes(role)
? library.favorites.length > 0
? FlagIcon
: FlagIconOutline
: library.favorites.length > 0
? StarIcon
: StarIconOutline
}
dataTip={
AdminRoles.includes(role)
? 'Feature Library'
: 'Favorite Library'
}
/>
</div>
)}

<div
className="absolute right-2 top-2 z-100"
onClick={(e) => void toggleLibraryFavorite(e)}
>
{/* don't display the favorite toggle when admin is viewing in student view*/}
<ULIComponent
tooltipClassName="absolute right-2 top-2 z-100"
iconClassName={`w-6 h-6 ${library.favorites.length > 0 && 'text-primary-yellow'}`}
icon={
AdminRoles.includes(role)
? library.favorites.length > 0
? FlagIcon
: FlagIconOutline
: library.favorites.length > 0
? StarIcon
: StarIconOutline
}
dataTip={
AdminRoles.includes(role)
? 'Feature Library'
: 'Favorite Library'
}
/>
</div>

<div className="p-4 space-y-2">
<p className="body-small">{'Kiwix'}</p>
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/Components/OperationalInsightsCharts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,19 +36,19 @@ const OperationalInsights = () => {
const metrics = data?.data;

return (
<div className="p-8">
<div className="p-6">
{error && <div>Error loading data</div>}
{!data || (isLoading && <div>Loading...</div>)}
{data && metrics && (
<>
<div className="p-4">
<div className="">
<button
className="button"
onClick={() => setResetCache(!resetCache)}
>
Refresh Data
</button>
<div className="flex flex-row gap-4">
<div className="flex flex-row gap-4 pb-4">
<div>
<label htmlFor="days" className="label">
<span className="label-text">Days</span>
Expand Down
6 changes: 4 additions & 2 deletions frontend/src/Pages/OperationalInsights.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ import OperationalInsights from '@/Components/OperationalInsightsCharts';
export default function OperationalInsightsPage() {
return (
<div>
<h1>Operational Insights</h1>
<OperationalInsights />
<div className="px-8 pb-4 mt-8">
<h1>Operational Insights</h1>
<OperationalInsights />
</div>
</div>
);
}

0 comments on commit 3138feb

Please sign in to comment.