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

fix(home) : Utilisation plus simple de la page d'accueil (Android) + Quelques nouveautés #372

Closed
wants to merge 32 commits into from
Closed
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
6d69f24
Revert "!feat(Home): Rewritten Home for performance issue"
Kgeek33 Nov 16, 2024
6cab818
fix typage + intégration des sections par ordre d'importance
Kgeek33 Nov 16, 2024
c27e8a7
fix affichage incorrct du nom du compte en mode clair + suppression v…
Kgeek33 Nov 16, 2024
1e5494a
fix non affichage de l'influence depuis l'accueil
Kgeek33 Nov 16, 2024
fb7e1c3
fix affichage vide quand salle inconnue
Kgeek33 Nov 16, 2024
ff9ba69
Merge branch 'main' into fix/home
Kgeek33 Nov 16, 2024
290f602
Merge branch 'main' into fix/home
Kgeek33 Nov 18, 2024
5f36733
Rename Home.tsx to Home.android.tsx
Kgeek33 Nov 19, 2024
dfa979e
Create Home.ios.tsx
Kgeek33 Nov 19, 2024
488855f
Create ModalContent.tsx
Kgeek33 Nov 19, 2024
27ee23b
Update Home.android.tsx
Kgeek33 Nov 19, 2024
7c63aed
Update Home.ios.tsx
Kgeek33 Nov 19, 2024
16c07ed
affichage corect des pages en fonction du système
Kgeek33 Nov 19, 2024
f961e15
fix import des accueils
Kgeek33 Nov 19, 2024
93725c7
Merge branch 'main' into fix/home
Kgeek33 Nov 21, 2024
21a4295
Merge branch 'main' into fix/home
Kgeek33 Nov 25, 2024
8830d19
Merge branch 'main' into fix/home
Kgeek33 Nov 26, 2024
329668b
Merge branch 'main' into fix/home
Kgeek33 Nov 29, 2024
9ec45b8
affichage correct des devoirs le week-end + optimisations
Kgeek33 Dec 2, 2024
76cb1b3
affichage d'un commentaire lorsque aucune absence
Kgeek33 Dec 2, 2024
1bc296b
affichage d'un commentaire lorsque aucune note
Kgeek33 Dec 2, 2024
4d205eb
suppression des marginTop
Kgeek33 Dec 2, 2024
c2a767c
nouvel émoji pour différencier des autres
Kgeek33 Dec 2, 2024
30480be
Merge branch 'main' into fix/home
Kgeek33 Dec 8, 2024
9dda5a8
Merge branch 'main' into fix/home
Kgeek33 Dec 11, 2024
ec90bfd
Merge branch 'main' into fix/home
Kgeek33 Dec 13, 2024
3e892c8
fix logs errors for style
Kgeek33 Dec 14, 2024
b18de09
suppression (comme en ce moment) de la page d'accueil sur Android
Kgeek33 Dec 14, 2024
f4e7707
delete `PlaceholderScreen.tsx` not use
Kgeek33 Dec 14, 2024
d074eb9
delete code not use + indentation
Kgeek33 Dec 14, 2024
6196d34
stabilité accrue de la page d'accueil
Kgeek33 Dec 14, 2024
4d8c705
Merge branch 'main' into fix/home
Kgeek33 Dec 15, 2024
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
53 changes: 5 additions & 48 deletions src/components/Home/AccountSwitcher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { useTheme } from "@react-navigation/native";
import { ChevronDown } from "lucide-react-native";

import Reanimated, {
interpolateColor,
LinearTransition, useAnimatedStyle,
LinearTransition,
SharedValue,
ZoomIn,
ZoomOut,
} from "react-native-reanimated";
Expand All @@ -14,16 +14,16 @@ import { useCurrentAccount } from "@/stores/account";
import { defaultProfilePicture } from "@/utils/ui/default-profile-picture";
import PapillonSpinner from "../Global/PapillonSpinner";
import { animPapillon } from "@/utils/ui/animations";
import Animated from "react-native-reanimated";
import { BlurView } from "expo-blur";
import Animated from "react-native-reanimated";

const ReanimatedBlurView = Reanimated.createAnimatedComponent(BlurView);

const AccountSwitcher: React.FC<{
small?: boolean,
opened?: boolean,
modalOpen?: boolean,
translationY?: Reanimated.SharedValue<number>,
translationY?: SharedValue<number>,
loading?: boolean,
}> = ({ small, opened, modalOpen, translationY, loading }) => {
const theme = useTheme();
Expand All @@ -33,51 +33,12 @@ const AccountSwitcher: React.FC<{

const shouldHideName = account.personalization.hideNameOnHomeScreen || false;
const shouldHidePicture = account.personalization.hideProfilePicOnHomeScreen || false;

const borderAnimatedStyle = useAnimatedStyle(() => ({
borderWidth: 1,
borderRadius: 80,
borderColor: interpolateColor(
translationY?.value || 0, // Should think to pass a default value
[200, 251],
["#ffffff50", colors.border],
),
backgroundColor: interpolateColor(
translationY?.value || 0, // Should think to pass a default value
[200, 251],
["#ffffff30", "transparent"],
),
}));

const textAnimatedStyle = useAnimatedStyle(() => ({
color: interpolateColor(
translationY?.value || 0, // Should think to pass a default value
[200, 251],
["#FFF", colors.text],
),
fontSize: 16,
fontFamily: "semibold",
maxWidth: 140,
}));


const AnimatedChevronDown = Animated.createAnimatedComponent(ChevronDown);
const iconAnimatedStyle = useAnimatedStyle(() => ({
color: interpolateColor(
translationY?.value || 0, // Should think to pass a default value
[200, 251],
["#FFF", colors.text],
),
marginLeft: -6,
}));

return (
<Reanimated.View
style={{
backgroundColor:
opened ?
theme.dark && !modalOpen ? "#00000044" : "#FFFFFF22"
: modalOpen ? colors.text + "10" : "#FFFFFF12",
backgroundColor: colors.primary + "70",
borderRadius: 12,
borderCurve: "continuous",
overflow: "hidden",
Expand Down Expand Up @@ -211,10 +172,6 @@ const styles = StyleSheet.create({
borderColor: "#00000020",
borderWidth: 1,
},

accountSwitcherText: {

},
});

export default AccountSwitcher;
137 changes: 137 additions & 0 deletions src/views/account/Home/Animations/HomeAnimations.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
import {
useAnimatedStyle,
interpolate,
Extrapolate,
type SharedValue,
} from "react-native-reanimated";
import type { EdgeInsets } from "react-native-safe-area-context";

const HEADER_HEIGHT_FACTOR = 1.5;
const CORNER_RADIUS_FACTOR = 4;
const OVER_HEADER_HEIGHT_FACTOR = 2;

const stylezAnim = (translationY: SharedValue<number>, headerHeight: number) => useAnimatedStyle(() => {
const opacity = interpolate(
translationY.value,
[10, 240],
[1, 0],
Extrapolate.CLAMP
);

const translateY = interpolate(
translationY.value,
[0 - headerHeight, 0, headerHeight],
[(0 - headerHeight) / HEADER_HEIGHT_FACTOR, 0, headerHeight / 1.5],
Extrapolate.CLAMP
);

return {
transform: [{ translateY }],
opacity,
};
});

const overHeaderAnimAnim = (translationY: SharedValue<number>, headerHeight: number) => useAnimatedStyle(() => {
const opacity = interpolate(
translationY.value,
[headerHeight - 48, headerHeight],
[0, 1],
Extrapolate.CLAMP
);

const translateY = interpolate(
translationY.value,
[headerHeight - 48, headerHeight],
[48, 0],
Extrapolate.CLAMP
);

return {
opacity,
transform: [{ translateY }],
};
});

const cardStyleAnim = (translationY: SharedValue<number>, headerHeight: number) => useAnimatedStyle(() => {
const scale = interpolate(
translationY.value,
[0, headerHeight / 3, headerHeight],
[1, 0.94, 1],
Extrapolate.CLAMP
);

return {
transform: [{ scale }],
};
});

const cornerStyleAnim = (translationY: SharedValue<number>, headerHeight: number, corners: number) => useAnimatedStyle(() => {
const animatedCorners = interpolate(
translationY.value,
[100, headerHeight - 1, headerHeight],
[14, corners, 0],
Extrapolate.CLAMP
);

return {
borderTopLeftRadius: animatedCorners,
borderTopRightRadius: animatedCorners,
};
});

const backdropStyleAnim = (translationY: SharedValue<number>, headerHeight: number) => useAnimatedStyle(() => {
const opacity = interpolate(
translationY.value,
[headerHeight - 180, headerHeight],
[0, 0.6],
Extrapolate.CLAMP
);

return {
opacity,
};
});

const paddingTopItemStyleAnim = (translationY: SharedValue<number>, insets: EdgeInsets, headerHeight: number, overHeaderHeight: number) => useAnimatedStyle(() => {
const paddingTop = interpolate(
translationY.value,
[1, headerHeight],
[20, insets.top + overHeaderHeight],
Extrapolate.CLAMP
);

return {
paddingTop,
};
});

const accountSwitcherAnim = (translationY: SharedValue<number>, insets: EdgeInsets, headerHeight: number) => useAnimatedStyle(() => {
const top = interpolate(
translationY.value,
[0, headerHeight],
[0, 0 - insets.top * OVER_HEADER_HEIGHT_FACTOR],
Extrapolate.CLAMP
);

const opacity = interpolate(
translationY.value,
[0, headerHeight / 1.5],
[1, 0],
Extrapolate.CLAMP
);

return {
top,
opacity,
};
});

export {
stylezAnim,
overHeaderAnimAnim,
cardStyleAnim,
cornerStyleAnim,
backdropStyleAnim,
paddingTopItemStyleAnim,
accountSwitcherAnim,
};
2 changes: 1 addition & 1 deletion src/views/account/Home/Elements/GradesElement.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ const GradesElement: React.FC<GradesElementProps> = ({ onImportance }) => {
navigation={PapillonNavigation.current}
index={index}
totalItems={lastThreeGrades.length}
allGrades={[]}
allGrades={grades[defaultPeriod] || []}
/>
))}
</NativeList>
Expand Down
Loading
Loading