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

Commit

Permalink
Merge pull request #269 from Gabriel29306/customHomeworkRedesign
Browse files Browse the repository at this point in the history
Enhancement: Modifiaction de l'interface de devoirs custom sur Android + Possibilité d'avoir du multi line
  • Loading branch information
LeGeek01 authored Jun 14, 2024
2 parents 49b5da0 + 074d0cd commit 874830a
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 8 deletions.
7 changes: 5 additions & 2 deletions views/Devoirs/CreateHomeworkScreen.android.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -386,12 +386,13 @@ function CreateHomeworkScreenAndroid({ route, navigation }: {
</NativeItem>
<NativeItem>
<TextInput
placeholder="Contenu du devoir"
placeholder="Contenu du devoir..."
placeholderTextColor={UIColors.text + '77'}
style={[styles.input, {color: UIColors.text}]}
value={homeworkContent}
onChangeText={text => setHomeworkContent(text)}
ref={textInputRef}
multiline={true}
/>
</NativeItem>
</NativeList>
Expand All @@ -401,10 +402,12 @@ function CreateHomeworkScreenAndroid({ route, navigation }: {

const styles = StyleSheet.create({
input: {
paddingVertical: 14,
paddingVertical: 1,
paddingHorizontal: 16,
fontFamily: 'Papillon-Medium',
fontSize: 16,
minHeight: 100,
lineHeight: 16
},
inputSubject: {
fontFamily: 'Papillon-Medium',
Expand Down
10 changes: 7 additions & 3 deletions views/Devoirs/HwScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ function HomeworkScreen({ route, navigation }: {
navigation.navigate("CreateHomework", {homeworkLocalID: homeworkLocalID});
}}
>
<Pencil size={20} color={'#0000ff'} />
<Pencil size={20} color={'#3493eb'} />
</TouchableOpacity>
<TouchableOpacity
style={[styles.deleteHw]}
Expand Down Expand Up @@ -165,7 +165,11 @@ function HomeworkScreen({ route, navigation }: {
]
}
>
{convertHTML(homework.description)}
{convertHTML(
homework.custom ? homework.description
: homework.description.replace('\n', ' '),
{ preserveNewlines: true }
)}
</ParsedText>
</NativeItem>
{homework.difficulty !== PronoteApiHomeworkDifficulty.NONE && (
Expand Down Expand Up @@ -472,7 +476,7 @@ const styles = StyleSheet.create({
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'center',
backgroundColor: '#0000ff22',
backgroundColor: '#3493eb22',
borderRadius: 12,
borderCurve: 'continuous',
paddingVertical: 8,
Expand Down
6 changes: 5 additions & 1 deletion views/DevoirsScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -400,7 +400,11 @@ function Hwitem({ homework, openURL, navigation }: {
</View>
<View>
<NativeText>
{convertHTML(homework.description.replace('\n', ' '), { wordwrap: 130 })}
{convertHTML(
homework.custom ? homework.description
: homework.description.replace('\n', ' '),
{ wordwrap: 130 }
)}
</NativeText>
</View>
</NativeItem>
Expand Down
8 changes: 6 additions & 2 deletions views/HomeScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1340,11 +1340,15 @@ function DevoirsContent({
styles.homeworksDevoirsContentContentDescription,
{
color: UIColors.text,
height: homework.description.length > 40 ? 38 : 20,
height: (homework.description.length > 40) || homework.custom ? 38 : 20,
},
]}
>
{convertHTML(homework.description)}
{convertHTML(
homework.custom ? homework.description
: homework.description.replace('\n', ' '),
{ preserveNewlines: true }
)}
</Text>
</Animated.View>

Expand Down

0 comments on commit 874830a

Please sign in to comment.