Skip to content
This repository has been archived by the owner on Aug 25, 2024. It is now read-only.

Commit

Permalink
feat: 💄 Affichage des séparateurs sur l'écran des cours
Browse files Browse the repository at this point in the history
  • Loading branch information
ecnivtwelve committed Apr 1, 2024
1 parent 00a689f commit 48d428c
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 27 deletions.
18 changes: 16 additions & 2 deletions interface/CoursScreen/TimeSeparator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,30 @@ import {
} from 'lucide-react-native';
import { PressableScale } from 'react-native-pressable-scale';

const TimeSeparator = ({ reason, time, lunch }) => {
const TimeSeparator = ({ style, showLine, reason, time, lunch }) => {
const UIColors = GetUIColors();

return (
<PressableScale style={[
styles.timeSeparator,
{
backgroundColor: UIColors.text + '08',
}
},
style
]}>
{showLine &&
<View
style={{
position: 'absolute',
top: 0,
bottom: 0,
left: 0,
height: '100%',
width:4,
backgroundColor: UIColors.border
}}
/>
}
<Image source={require('../../assets/stripes.png')} style={[styles.stripes, {tintColor: UIColors.text}]} />
<View style={[styles.separatorData]}>
<View style={[styles.reasonContainer]}>
Expand Down
55 changes: 30 additions & 25 deletions views/CoursScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import { PressableScale } from 'react-native-pressable-scale';
import { ScrollView } from 'react-native-gesture-handler';
import { useTheme, Text } from 'react-native-paper';
import { SFSymbol } from 'react-native-sfsymbols';
import TimeSeparator from '../interface/CoursScreen/TimeSeparator';

import * as Notifications from 'expo-notifications';
import * as Calendar from 'expo-calendar';
Expand Down Expand Up @@ -895,34 +896,38 @@ function CoursPage({ cours, navigation, forceRefresh }: {
{cours.map((lesson, index) => (
<View key={lesson.id}>
{index !== 0 && new Date(lesson.start).getTime() - new Date(cours[index - 1].end).getTime() > 1800000 && (
<View style={styles.coursSeparator}>
<View
style={[
styles.coursSeparatorLine,
{ backgroundColor: `${UIColors.text}15` },
]}
/>

<Text style={{ color: `${UIColors.text}30` }}>
{`${Math.floor(
(new Date(lesson.start).getTime() - new Date(cours[index - 1].end).getTime()) /
<TimeSeparator
reason={
(new Date(cours[index - 1].end).getHours() < 13 &&
new Date(lesson.start).getHours() >= 12) ?
'Pause méridienne'
: 'Pas de cours'
}
time={`${Math.floor(
(new Date(lesson.start).getTime() -
new Date(cours[index - 1].end).getTime()) /
3600000
)} h ${lz(
Math.floor(
((new Date(lesson.start).getTime() - new Date(cours[index - 1].end).getTime()) %
)} h ${lz(
Math.floor(
((new Date(lesson.start).getTime() -
new Date(cours[index - 1].end).getTime()) %
3600000) /
60000
)
)} min`}
</Text>

<View
style={[
styles.coursSeparatorLine,
{ backgroundColor: `${UIColors.text}15` },
]}
/>
</View>
)
)} min`}
lunch={
new Date(cours[index - 1].end).getHours() < 13 &&
new Date(lesson.start).getHours() >= 12
}
showLine
style={{
marginHorizontal: 0,
marginTop: 0,
marginBottom: 8,
height: 38,
marginLeft: 69,
}}
/>
)}

<CoursItem
Expand Down

0 comments on commit 48d428c

Please sign in to comment.