Skip to content

Commit

Permalink
fix: correct visibility status query and rendering
Browse files Browse the repository at this point in the history
  • Loading branch information
calisio committed Dec 13, 2024
1 parent 3c4cfa1 commit 08a8491
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
4 changes: 2 additions & 2 deletions backend/src/database/open_content.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ func (db *DB) GetUserFavorites(userID uint, page, perPage int) (int64, []models.
lib.url,
lib.thumbnail_url,
ocp.description,
NOT lib.visibility_status,
lib.visibility_status,
lib.open_content_provider_id,
ocp.title AS provider_name,
NULL AS channel_title,
Expand All @@ -131,7 +131,7 @@ func (db *DB) GetUserFavorites(userID uint, page, perPage int) (int64, []models.
videos.url,
videos.thumbnail_url,
videos.description,
NOT videos.visibility_status,
videos.visibility_status,
videos.open_content_provider_id,
NULL AS provider_name,
videos.channel_title,
Expand Down
12 changes: 7 additions & 5 deletions frontend/src/Components/FavoriteCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const FavoriteCard: React.FC<FavoriteCardProps> = ({
const { toaster } = useToast();

const handleCardClick = () => {
if (favorite.visibility_status) {
if (!favorite.visibility_status) {
return;
}
if (favorite.content_type === 'video') {
Expand Down Expand Up @@ -50,11 +50,13 @@ const FavoriteCard: React.FC<FavoriteCardProps> = ({
<div
className={`card p-4 space-y-2 ${
favorite.visibility_status
? 'bg-grey-2 cursor-not-allowed'
: 'bg-inner-background cursor-pointer'
? 'bg-inner-background cursor-pointer'
: 'bg-grey-2 cursor-not-allowed'
} tooltip `}
data-tip={favorite.visibility_status ? 'Unavailable Content' : ''}
onClick={favorite.visibility_status ? undefined : handleCardClick}
{...(!favorite.visibility_status && {
'data-tip': 'Unavailable Content'
})}
onClick={favorite.visibility_status ? handleCardClick : undefined}
>
{!isAdminInStudentView && (
<div
Expand Down

0 comments on commit 08a8491

Please sign in to comment.