Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(statistics): new statistics section #462

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
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
82 changes: 81 additions & 1 deletion assets/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,84 @@
"courseGuideScreen": {
"title": "Course guide"
},
"courseStatisticsScreen": {
"title": "TODO",
"subtitle": "TODO",
"noData": "TODO",
"period": "TODO",
"teacher": "TODO",
"enrolledExamTitle": "TODO",
"enrolledExamInfo": "TODO",
"enrolledExamDetailTitle": "TODO",
"enrolledExamDetailInfo": "TODO",
"examGradeDetailTitle": "TODO",
"examGradeDetailInfo": "TODO",
"enrolledExamBottomSheet": {
"title": "TODO",
"content": "TODO",
"item1": {
"title": "TODO",
"content": "TODO"
},
"item2": {
"title": "TODO",
"content": "TODO"
}
},
"enrolledExamDetailBottomSheet": {
"title": "TODO",
"content": "TODO",
"item1": {
"title": "TODO",
"content": "TODO"
},
"item2": {
"title": "TODO",
"content": "TODO"
},
"item3": {
"title": "TODO",
"content": "TODO"
}
},
"gradesDetailBottomSheet": {
"title": "TODO",
"content": "TODO",
"item1": {
"title": "TODO",
"content": "TODO"
},
"item2": {
"title": "TODO",
"content": "TODO"
},
"item3": {
"title": "TODO",
"content": "TODO"
}
},
"gradesDetailLegend": {
"averageGrade": "TODO",
"firstYear": "TODO",
"secondYear": "TODO",
"otherYears": "TODO"
},
"enrolledExamChartLabel": {
"firstYear": "TODO",
"secondYear": "TODO",
"otherYears": "TODO"
},
"enrolledExamChartLegend": {
"passed": "TODO",
"failed": "TODO"
},
"enrolledExamVisualization": {
"title": "TODO",
"single": "TODO",
"compare": "TODO",
"error": "TODO"
}
},
"courseIconPickerScreen": {
"title": "Pick an icon"
},
Expand Down Expand Up @@ -391,7 +469,9 @@
"period": "Period",
"staff": "Staff",
"title": "Course",
"tutoring": "Tutoring"
"tutoring": "Tutoring",
"statistics": "Statistics",
"statisticsSubtitle": "See exam statistics"
},
"degreeScreen": {
"cohort": "Coorte",
Expand Down
82 changes: 81 additions & 1 deletion assets/translations/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,84 @@
"courseGuideScreen": {
"title": "Guida del corso"
},
"courseStatisticsScreen": {
"title": "Statistiche",
"subtitle": "Accedi alle statistiche d'esame",
"noData": "Dati non disponibili",
"period": "Periodo",
"teacher": "Docente",
"enrolledExamTitle": "Superamento esame",
"enrolledExamInfo": "Informazioni superamento esame",
"enrolledExamDetailTitle": "Dettaglio superamento esame",
"enrolledExamDetailInfo": "Informazioni dettaglio superamento esame",
"examGradeDetailTitle": "Dettaglio voti",
"examGradeDetailInfo": "Informazioni dettaglio voti",
"enrolledExamBottomSheet": {
"title": "Superamento esame",
"content": "Statistica riguardante il numero di superi totali all’esame con due tipi di visualizzazione:",
"item1": {
"title": "Singola",
"content": "statistica del singolo anno selezionato."
},
"item2": {
"title": "Comparativa",
"content": "comparazione tra l’anno selezionato e i due anni precedenti."
}
},
"enrolledExamDetailBottomSheet": {
"title": "Dettaglio superamento esame",
"content": "Statistica riguardante il numero di superi all’esame suddiviso in tre sotto gruppi:",
"item1": {
"title": "iscritti al 1° anno",
"content": " studenti che si sono iscritti all’esame durante il primo anno di frequenza."
},
"item2": {
"title": "iscritti al 2° anno",
"content": " studenti che si sono iscritti all’esame durante il secondo anno di frequenza."
},
"item3": {
"title": "iscritti dal 3° anno in poi",
"content": " studenti che si sono iscritti all’esame dal terzo anno di frequenza in poi."
}
},
"gradesDetailBottomSheet": {
"title": "Dettaglio voti",
"content": "Statistica riguardante il dettaglio delle valutazioni d’esame suddiviso in tre sotto gruppi:",
"item1": {
"title": "iscritti al 1° anno",
"content": " studenti che si sono iscritti all’esame durante il primo anno di frequenza."
},
"item2": {
"title": "iscritti al 2° anno",
"content": " studenti che si sono iscritti all’esame durante il secondo anno di frequenza."
},
"item3": {
"title": "iscritti dal 3° anno in poi",
"content": " studenti che si sono iscritti all’esame dal terzo anno di frequenza in poi."
}
},
"gradesDetailLegend": {
"averageGrade": "Votazione media",
"firstYear": "Iscritti al 1° anno",
"secondYear": "Iscritti al 2° anno",
"otherYears": "Iscritti dal 3° anno in poi"
},
"enrolledExamChartLabel": {
"firstYear": "1° anno",
"secondYear": "2° anno",
"otherYears": "3° anno in poi"
},
"enrolledExamChartLegend": {
"passed": "Esame superato",
"failed": "Esame non superato"
},
"enrolledExamVisualization": {
"title": "Visualizzazione",
"single": "Singola",
"compare": "Comparativa",
"error": "Visualizzazione comparativa non disponibile per mancanza di dati nei periodi precedenti"
}
},
"courseIconPickerScreen": {
"title": "Seleziona un'icona"
},
Expand Down Expand Up @@ -391,7 +469,9 @@
"period": "Periodo",
"staff": "Docenti",
"title": "Corso",
"tutoring": "Tutoraggio"
"tutoring": "Tutoraggio",
"statistics": "Statistiche",
"statisticsSubtitle": "Accedi alle statistiche d'esame"
},
"degreeScreen": {
"cohort": "Coorte",
Expand Down
73 changes: 47 additions & 26 deletions lib/ui/components/SectionHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@ import {
TextProps,
TextStyle,
TouchableOpacity,
TouchableOpacityProps,
View,
} from 'react-native';

import { Props as FAProps } from '@fortawesome/react-native-fontawesome';
import { IconButton } from '@lib/ui/components/IconButton';
import { Separator } from '@lib/ui/components/Separator';
import { Link, useNavigation } from '@react-navigation/native';
import { NativeStackNavigationProp } from '@react-navigation/native-stack';
Expand All @@ -23,12 +26,16 @@ interface Props {
subtitle?: string;
subtitleStyle?: StyleProp<TextStyle>;
ellipsizeTitle?: boolean;
linkTo?: To<any>;
linkToMoreCount?: number;
trailingItem?: JSX.Element;
separator?: boolean;
accessible?: boolean;
accessibilityLabel?: string | undefined;
linkTo?: To<any>;
trailingItem?: JSX.Element;
trailingIcon?: Pick<FAProps, 'size' | 'icon' | 'color'> &
TouchableOpacityProps & {
iconStyle?: FAProps['style'];
};
}

/**
Expand All @@ -46,6 +53,7 @@ export const SectionHeader = ({
linkToMoreCount,
separator = true,
trailingItem,
trailingIcon,
}: Props) => {
const styles = useStylesheet(createStyles);
const { t } = useTranslation();
Expand All @@ -59,18 +67,25 @@ export const SectionHeader = ({

const Header = () => {
return (
<View style={styles.innerContainer}>
<View style={{ ...styles.innerContainer }}>
<View style={styles.titleContainer}>
{separator && <Separator />}
<Text
accessible={false}
variant="heading"
style={[styles.title, titleStyle]}
accessibilityRole="header"
{...ellipsis}
>
{title}
</Text>

<View style={{ ...styles.innerTitleContainer }}>
<Text
accessible={false}
variant="heading"
style={[styles.title, titleStyle, styles.titleContainer]}
accessibilityRole="header"
{...ellipsis}
>
{title}
</Text>
{trailingIcon && (
<IconButton {...{ size: 16, ...trailingIcon, noPadding: true }} />
)}
</View>

{subtitle && (
<Text
accessible={false}
Expand All @@ -83,20 +98,20 @@ export const SectionHeader = ({
</Text>
)}
</View>
{trailingItem
? trailingItem
: linkTo && (
<Link to={linkTo} accessible={true} accessibilityRole="button">
<Text variant="link">
{t('sectionHeader.cta')}
{(linkToMoreCount ?? 0) > 0 &&
' ' +
t('sectionHeader.ctaMoreSuffix', {
count: linkToMoreCount,
})}
</Text>
</Link>
)}
{trailingItem && trailingItem}

{linkTo && (
<Link to={linkTo} accessible={true} accessibilityRole="button">
<Text variant="link">
{t('sectionHeader.cta')}
{(linkToMoreCount ?? 0) > 0 &&
' ' +
t('sectionHeader.ctaMoreSuffix', {
count: linkToMoreCount,
})}
</Text>
</Link>
)}
</View>
);
};
Expand Down Expand Up @@ -152,4 +167,10 @@ const createStyles = ({ spacing, colors }: Theme) =>
titleContainer: {
flex: 1,
},
innerTitleContainer: {
alignItems: 'center',
flexDirection: 'row',
padding: 0,
margin: 0,
},
});
48 changes: 48 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading