Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Bri74 authored Oct 28, 2024
2 parents e5cbebb + 3ac5546 commit 4475b53
Show file tree
Hide file tree
Showing 20 changed files with 314 additions and 113 deletions.
14 changes: 9 additions & 5 deletions assets/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -504,8 +504,10 @@
"location": "Location",
"noClassroom": "No place specified for this exam call",
"noLocation": "Room to be defined",
"notAvailable": "Booking not available",
"notes": "Notes",
"title": "Exam call"
"title": "Exam call",
"noBookedCount": "Data not available"
},
"examsScreen": {
"emptyState": "There are no open exam calls",
Expand Down Expand Up @@ -569,7 +571,8 @@
"title": "Log in with your polito.it credentials",
"unsupportedUserType": "User type not supported: only students can log in to PoliTO Students.",
"usernameLabel": "Student ID",
"usernameLabelAccessibility": "Enter your username here"
"usernameLabelAccessibility": "Enter your username here",
"fcmUnsupported": "An error occurred during push notifications setup. This problem can be caused by the lack of Google Play Services on this device. It is possible to keep using this app, however push notifications won't be received."
},
"messageScreen": {
"backTitle": "Archive",
Expand Down Expand Up @@ -697,12 +700,12 @@
"trainingOffer": "Training offer"
},
"provisionalGradeScreen": {
"acceptGradeConfirmMessage": "By accepting this evaluation you will no longer be able to change your decision",
"acceptGradeConfirmMessage": "By requesting immediate registration, the evaluation will be recorded in your transcript and you will no longer be able to change your decision",
"acceptGradeCta": "Request immediate registration",
"acceptGradeFeedback": "The evaluation has been recorded, it will appear in the transcript",
"contactProfessorCta": "Contact the teacher",
"rejectGradeConfirmMessage": "By rejecting this evaluation you will no longer be able to change your decision",
"rejectGradeCta": "Reject the evaluation",
"rejectGradeCta": "Reject the evaluation by: <br><b>{{hours}}</b>",
"rejectGradeFeedback": "Evaluation rejected, it will be recorded in the next few hours",
"title": "Evaluation"
},
Expand Down Expand Up @@ -787,13 +790,14 @@
"title": "Evaluation"
},
"transcriptGradesScreen": {
"autoRegistration": "Automatic registration in:",
"emptyState": "You haven't taken any exams",
"expiredCountdown": "Expired",
"provisionalEmptyState": "There are no provisional grades",
"provisionalTitle": "Provisional",
"recordedTitle": "Recorded",
"rejectedSubtitle": "Rejected on {{-date}} at {{-time}}",
"rejectionCountdown": "Rejectable by:",
"rejectionCountdown": "Rejectable by: <b>{{hours}}</b>",
"title": "Grades",
"total": "There are {{total}} grades"
},
Expand Down
16 changes: 10 additions & 6 deletions assets/translations/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -504,8 +504,10 @@
"location": "Luogo",
"noClassroom": "Nessun luogo specificato per questo appello",
"noLocation": "Aula da definire",
"notAvailable": "Prenotazione non disponibile",
"notes": "Note",
"title": "Appello"
"title": "Appello",
"noBookedCount": "Dato non disponibile"
},
"examsScreen": {
"emptyState": "Non ci sono appelli disponibili",
Expand Down Expand Up @@ -569,7 +571,8 @@
"title": "Accedi con le tue credenziali polito.it",
"unsupportedUserType": "Tipo utente non supportato: PoliTO Students è accessibile solamente agli studenti.",
"usernameLabel": "Matricola",
"usernameLabelAccessibility": "Inserisci qui il tuo username"
"usernameLabelAccessibility": "Inserisci qui il tuo username",
"fcmUnsupported": "Si è verificato un errore durante l'attivazione delle notifiche push. Questo problema può essere causato dall'assenza dei servizi Google su questo dispositivo. È possibile continuare ad utilizzare l'app ma non si riceveranno notifiche push."
},
"messageScreen": {
"backTitle": "Archivio",
Expand Down Expand Up @@ -697,12 +700,12 @@
"trainingOffer": "Offerta formativa"
},
"provisionalGradeScreen": {
"acceptGradeConfirmMessage": "Accettando il voto non potrai più cambiare la tua decisione",
"acceptGradeConfirmMessage": "Richiedendo la registrazione immediata la valutazione verrà inserita in libretto e non potrai più cambiare la tua decisione",
"acceptGradeCta": "Richiedi la registrazione immediata",
"acceptGradeFeedback": "Valutazione registrata, verrà visualizzata nel libretto",
"contactProfessorCta": "Contatta il docente",
"rejectGradeConfirmMessage": "Rifiutando il voto non potrai più cambiare la tua decisione",
"rejectGradeCta": "Rifiuta la valutazione",
"rejectGradeConfirmMessage": "Rifiutando la valutazione non potrai più cambiare la tua decisione",
"rejectGradeCta": "Rifiuta la valutazione entro:<br><b>{{hours}}</b>",
"rejectGradeFeedback": "Valutazione rifiutata, verrà registrata nelle prossime ore",
"title": "Valutazione"
},
Expand Down Expand Up @@ -787,13 +790,14 @@
"title": "Valutazione"
},
"transcriptGradesScreen": {
"autoRegistration": "Registrazione automatica tra:",
"emptyState": "Non hai sostenuto nessun esame",
"expiredCountdown": "Scaduto",
"provisionalEmptyState": "Non ci sono valutazioni provvisorie",
"provisionalTitle": "Provvisorie",
"recordedTitle": "Registrate",
"rejectedSubtitle": "Rifiutato il {{-date}} alle {{-time}}",
"rejectionCountdown": "Rifiutabile entro:",
"rejectionCountdown": "Rifiutabile entro: <b>{{hours}}</b>",
"title": "Valutazioni",
"total": "Sono presenti {{total}} valutazioni"
},
Expand Down
19 changes: 8 additions & 11 deletions lib/ui/components/CtaButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { useTheme } from '@lib/ui/hooks/useTheme';
import { Theme } from '@lib/ui/types/Theme';
import { shadeColor } from '@lib/ui/utils/colors';

import { TextWithLinks } from '../../../src/core/components/TextWithLinks';
import { useFeedbackContext } from '../../../src/core/contexts/FeedbackContext';
import { useSafeBottomBarHeight } from '../../../src/core/hooks/useSafeBottomBarHeight';

Expand Down Expand Up @@ -54,7 +55,8 @@ export const CtaButton = ({
variant = 'filled',
...rest
}: Props) => {
const { palettes, colors, fontSizes, spacing, dark } = useTheme();
const { palettes, colors, fontSizes, spacing, dark, fontWeights } =
useTheme();
const styles = useStylesheet(createStyles);
const { left, right } = useSafeAreaInsets();
const bottomBarHeight = useSafeBottomBarHeight();
Expand Down Expand Up @@ -159,7 +161,7 @@ export const CtaButton = ({
style={{ marginRight: spacing[2] }}
/>
)}
<Text
<TextWithLinks
style={[
styles.textStyle,
variant === 'outlined' && {
Expand All @@ -168,10 +170,12 @@ export const CtaButton = ({
{
color: variant === 'filled' ? colors.white : color,
},
disabled ? { color: colors.disableTitle } : undefined,
]}
baseStyle={{ fontWeight: fontWeights.medium }}
>
{title}
</Text>
</TextWithLinks>
{rightExtra && rightExtra}
</View>
</Row>
Expand All @@ -190,13 +194,7 @@ export const CtaButtonSpacer = () => {
return <View style={{ height: spacing[20] }} />;
};

const createStyles = ({
colors,
shapes,
spacing,
fontSizes,
fontWeights,
}: Theme) =>
const createStyles = ({ colors, shapes, spacing, fontSizes }: Theme) =>
StyleSheet.create({
container: {
padding: spacing[4],
Expand All @@ -222,7 +220,6 @@ const createStyles = ({
},
textStyle: {
fontSize: fontSizes.md,
fontWeight: fontWeights.medium,
textAlign: 'center',
color: colors.white,
},
Expand Down
1 change: 1 addition & 0 deletions lib/ui/components/CtaButtonContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ export const CtaButtonContainer = ({
},
absolute && {
position: 'absolute',
width: Platform.select({ android: '100%' }),
left: Platform.select({ ios: left }),
right,
bottom:
Expand Down
41 changes: 41 additions & 0 deletions lib/ui/components/ErrorCard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { PropsWithChildren } from 'react';
import { Platform, ViewProps } from 'react-native';

import { Card } from '@lib/ui/components/Card';
import { Text } from '@lib/ui/components/Text';
import { useTheme } from '@lib/ui/hooks/useTheme';

type Props = PropsWithChildren<
ViewProps & {
text: string;
}
>;

export const ErrorCard = ({ text, ...rest }: Props) => {
const { spacing, fontSizes, colors } = useTheme();
return (
<Card
accessible={Platform.select({ android: true, ios: false })}
rounded
// rounded={rounded ?? Platform.select({ android: false })}
spaced
translucent={false}
style={{
borderStyle: 'solid',
borderWidth: 1,
borderColor: colors.errorCardBorder,
}}
{...rest}
>
<Text
style={{
padding: spacing[5],
color: colors.errorCardText,
fontSize: fontSizes.sm,
}}
>
{text.charAt(0).toUpperCase() + text.slice(1).toLowerCase()}
</Text>
</Card>
);
};
3 changes: 3 additions & 0 deletions lib/ui/types/Theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ export interface Colors {
heading: string;
subHeading: string;
prose: string;
disableTitle: string;
longProse: string;
secondaryText: string;
caption: string;
Expand All @@ -96,6 +97,8 @@ export interface Colors {
deadlineCardBorder: string;
examCardBorder: string;
lectureCardSecondary: string;
errorCardText: string;
errorCardBorder: string;
translucentSurface: string;
white: string;
}
Expand Down
19 changes: 10 additions & 9 deletions package-lock.json

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

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@polito/students-app",
"version": "1.6.5",
"version": "1.6.6",
"private": true,
"scripts": {
"android": "react-native run-android --active-arch-only --appIdSuffix=dev",
Expand Down Expand Up @@ -28,7 +28,7 @@
"@miblanchard/react-native-slider": "^2.2.0",
"@openspacelabs/react-native-zoomable-view": "^2.1.5",
"@orama/orama": "^2.0.0-beta.8",
"@polito/api-client": "^1.0.0-ALPHA.63",
"@polito/api-client": "^1.0.0-ALPHA.64",
"@react-native-async-storage/async-storage": "^1.18.2",
"@react-native-clipboard/clipboard": "^1.12.1",
"@react-native-community/blur": "^4.3.0",
Expand Down Expand Up @@ -137,7 +137,7 @@
"jest": "^29.2.1",
"lint-staged": "^13.0.3",
"metro-react-native-babel-preset": "0.76.9",
"pod-install": "0.1.38",
"pod-install": "^0.2.2",
"prettier": "^2.7.1",
"react-test-renderer": "18.2.0",
"standard-version": "^9.5.0",
Expand Down
13 changes: 7 additions & 6 deletions src/core/components/TextWithLinks.tsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
import { PropsWithChildren } from 'react';
import { TextProps } from 'react-native';
import { MixedStyleDeclaration } from 'react-native-render-html';

import { linkUrls } from '../../utils/html';
import { HtmlView } from './HtmlView';

export const TextWithLinks = ({
children,
style,
}: PropsWithChildren<TextProps>) => {
if (!children || typeof children !== 'string') return null;
type Props = {
baseStyle?: MixedStyleDeclaration;
} & PropsWithChildren<TextProps>;

export const TextWithLinks = ({ baseStyle, children, style }: Props) => {
if (!children || typeof children !== 'string') return null;
const html = linkUrls(children);
return (
<HtmlView
source={{ html }}
baseStyle={{ padding: 0 }}
baseStyle={{ padding: 0, ...baseStyle }}
defaultTextProps={{ style: style }}
/>
);
Expand Down
12 changes: 8 additions & 4 deletions src/core/hooks/useDownloadCourseFile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,14 @@ export const useDownloadCourseFile = (
updateDownload({ isDownloaded: true });
} else {
// Update the name when changed
await mkdir(dirname(toFile));
await moveFile(cachedFilePath, toFile);
await cleanupEmptyFolders(coursesFilesCachePath);
refresh();
try {
await mkdir(dirname(toFile));
await moveFile(cachedFilePath, toFile);
await cleanupEmptyFolders(coursesFilesCachePath);
refresh();
} catch (_) {
// File rename was already scheduled
}
}
} else {
updateDownload({ isDownloaded: false });
Expand Down
Loading

0 comments on commit 4475b53

Please sign in to comment.