Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions src/app/components/elements/list-groups/AbstractListViewItem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,14 @@ export type AbstractListViewItemProps = {
subtitle?: string;
breadcrumb?: string[];
tags?: string[];
fullWidth?: boolean;
forceFullWidth?: boolean;
url?: string;
state?: AbstractListViewItemState;
className?: string;
hasCaret?: boolean;
} & ALVIType & ALVILayout;

export const AbstractListViewItem = ({title, icon, subject, subtitle, breadcrumb, tags, fullWidth, url, state, className, hasCaret, ...typedProps}: AbstractListViewItemProps) => {
export const AbstractListViewItem = ({title, icon, subject, subtitle, breadcrumb, tags, forceFullWidth, url, state, className, hasCaret, ...typedProps}: AbstractListViewItemProps) => {
const deviceSize = useDeviceSize();
const user = useAppSelector(selectors.user.orNull);

Expand All @@ -179,7 +179,9 @@ export const AbstractListViewItem = ({title, icon, subject, subtitle, breadcrumb
const isCrossTopic = isAda && tags?.includes("cross_topic");
const isLLM = tags?.includes("llm_question_page");

fullWidth = fullWidth || below["sm"](deviceSize) || (isItem && !(typedProps.status || typedProps.audienceViews));
const fullWidth = forceFullWidth || below["sm"](deviceSize) || (isItem && !(typedProps.status || typedProps.audienceViews));
const wrapTitleTags = below["xs"](deviceSize) || (isDefined(forceFullWidth) && !forceFullWidth);

const cardBody = <>
<div className="w-100 d-flex flex-row">
<Col className={classNames("d-flex flex-grow-1", {"mt-3": isCard, "mb-3": isCard && !typedProps.linkTags?.length})}>
Expand All @@ -194,7 +196,7 @@ export const AbstractListViewItem = ({title, icon, subject, subtitle, breadcrumb
{isGameboard && typedProps.board?.contents && <ItemCount count={typedProps.board.contents.length} />}
</div>
<div className={classNames("align-content-center text-overflow-ellipsis", siteSpecific("pe-2", "py-3"))}>
<div className="d-flex text-wrap mt-n1">
<div className={classNames("text-wrap mt-n1", {"d-flex": !wrapTitleTags})}>
{url && !isDisabled
? (url.startsWith("http")
? <ExternalLink href={url} className={classNames("alvi-title", {"question-link-title": isPhy || !isQuiz})}>
Expand All @@ -210,7 +212,7 @@ export const AbstractListViewItem = ({title, icon, subject, subtitle, breadcrumb
}
{isItem && <>
{typedProps.quizTag && <span className="quiz-level-1-tag ms-sm-2">{typedProps.quizTag}</span>}
<QuestionPropertyTags className="ms-2 justify-self-end" deprecated={typedProps.deprecated} supersededBy={typedProps.supersededBy} tags={tags} />
<QuestionPropertyTags className={classNames("justify-self-end", {"ms-2": !wrapTitleTags})} deprecated={typedProps.deprecated} supersededBy={typedProps.supersededBy} tags={tags} />
</>}
</div>
{subtitle && <div className="small text-muted text-wrap">
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/elements/list-groups/ListView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ type ListViewItemProps =

type ListViewProps<T, G extends "item" | "gameboard" | "quiz"> = {
className?: string;
fullWidth?: boolean;
forceFullWidth?: boolean;
hasCaret?: boolean;
} & (
{
Expand Down
5 changes: 2 additions & 3 deletions src/app/components/pages/MyProgress.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import {
import { TitleAndBreadcrumb } from "../elements/TitleAndBreadcrumb";
import { Card, CardBody, Col, Container, Row } from "reactstrap";
import {
below,
BookHiddenState,
HUMAN_QUESTION_TYPES,
ISAAC_BOOKS_BY_TAG,
Expand Down Expand Up @@ -188,11 +187,11 @@ const MyProgress = ({user}: MyProgressProps) => {
<Row id="progress-questions">
{progress?.mostRecentQuestions && progress?.mostRecentQuestions.length > 0 && <Col md={12} lg={6} className="mt-4">
<h4>Most recently answered questions</h4>
<ListView type="item" items={progress.mostRecentQuestions} fullWidth={below["lg"](screenSize)} className="bordered"/>
<ListView type="item" items={progress.mostRecentQuestions} forceFullWidth={["sm", "lg", "xl"].includes(screenSize)} className="bordered"/>
</Col>}
{progress?.oldestIncompleteQuestions && progress?.oldestIncompleteQuestions.length > 0 && <Col md={12} lg={6} className="mt-4">
<h4>Oldest unsolved questions</h4>
<ListView type="item" items={progress.oldestIncompleteQuestions} fullWidth={below["lg"](screenSize)} className="bordered"/>
<ListView type="item" items={progress.oldestIncompleteQuestions} forceFullWidth={["sm", "lg", "xl"].includes(screenSize)} className="bordered"/>
</Col>}
</Row>
</div>
Expand Down
Loading