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

Minor changes + Alerte déconnexion #113

Closed
wants to merge 26 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
ab365a7
URL in const
Slysoks Sep 2, 2024
588b9de
Too long text messages
Slysoks Sep 2, 2024
fe7254e
Formule de tutoiement
Slysoks Sep 2, 2024
3d3fa4b
Number of lines fix
Slysoks Sep 2, 2024
89f754a
Add https:// in front of URL if missing
Slysoks Sep 2, 2024
9fc6903
Displayed os type & version
Slysoks Sep 2, 2024
71f100e
Variable number of rows if the name exists or not
Slysoks Sep 2, 2024
0aec6ed
Removed useless imports
Slysoks Sep 2, 2024
2d2645a
Switched the two ToS & CGU links
Slysoks Sep 2, 2024
eceb451
style
Slysoks Sep 2, 2024
0fc2f10
refactor: Update background color and elevation of alert in Settings …
Slysoks Sep 2, 2024
c9bda1d
Merge branch 'main' of https://github.com/Slysoks/Papillon-1
Slysoks Sep 2, 2024
9228e42
Removed console.log()
Slysoks Sep 2, 2024
18c5d79
style: Added rows in bubble
Slysoks Sep 3, 2024
a19da89
Update Settings.tsx
Slysoks Sep 3, 2024
8b0efea
Update Settings.tsx
Slysoks Sep 3, 2024
77f4a17
Update Settings.tsx
Slysoks Sep 3, 2024
9c5524b
Update Settings.tsx
Slysoks Sep 3, 2024
a82de6f
Update Settings.tsx
Slysoks Sep 3, 2024
9b1d417
Update Settings.tsx
Slysoks Sep 3, 2024
a928a94
refactor: Update Settings.tsx with platform version and team message
Slysoks Sep 3, 2024
b52a5dd
feat: Open the donation url
Slysoks Sep 3, 2024
4bbea10
chore: Add beta description for Papillon Magic feature
Slysoks Sep 3, 2024
50cddbe
If average is NaN, the widget will not be displayed
Slysoks Sep 4, 2024
9e17fdc
feat: Go to Lessons page if press on widget
Slysoks Sep 4, 2024
035e909
Merge branch 'main' into main
Slysoks Sep 4, 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
Prev Previous commit
Next Next commit
Removed useless imports
Change disconnect alert to put a beatiful popup instead
  • Loading branch information
Slysoks committed Sep 2, 2024
commit 0aec6ede6456b36ed1a5bae0aba64220f5b70b90
88 changes: 69 additions & 19 deletions src/views/settings/Settings.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import type { Screen } from "@/router/helpers/types";
import React, { useEffect, useLayoutEffect, useState } from "react";
import { Alert, Image, Platform, Text, View } from "react-native";
import { Image, Platform, Text, View } from "react-native";
import { useAccounts, useCurrentAccount } from "@/stores/account";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import AppJSON from "../../../app.json";

import Reanimated, {
FadeIn,
FadeInDown,
FadeOut,
FadeOutDown,
runOnJS,
useAnimatedScrollHandler,
useSharedValue
Expand All @@ -24,7 +26,6 @@ import {
Paperclip,
Puzzle,
Route,
Scroll,
Settings as SettingsLucide,
Sparkles,
SwatchBook,
Expand All @@ -39,6 +40,7 @@ import {get_settings_widgets} from "@/addons/addons";
import AsyncStorage from "@react-native-async-storage/async-storage";
import {AddonPlacementManifest} from "@/addons/types";
import { useFlagsStore } from "@/stores/flags";
import ButtonCta from "@/components/FirstInstallation/ButtonCta";

const Settings: Screen<"Settings"> = ({ route, navigation }) => {
const theme = useTheme();
Expand All @@ -47,6 +49,7 @@ const Settings: Screen<"Settings"> = ({ route, navigation }) => {
const account = useCurrentAccount(store => store.account!);
const [ addons, setAddons ] = useState<Array<AddonPlacementManifest>>([]);
const [devModeEnabled, setDevModeEnabled] = useState(false);
const [disconnectPopup, setDisconnectPopup] = useState(false);
const defined = useFlagsStore(state => state.defined);

const removeAccount = useAccounts((store) => store.remove);
Expand Down Expand Up @@ -192,23 +195,7 @@ const Settings: Screen<"Settings"> = ({ route, navigation }) => {
color: "#CF0029",
label: "Se déconnecter",
onPress: () => {
Alert.alert("Se déconnecter", "Êtes-vous sûr de vouloir vous déconnecter ?", [
{
text: "Annuler",
style: "cancel",
},
{
text: "Se déconnecter",
style: "destructive",
onPress: () => {
removeAccount(account.localID);
navigation.reset({
index: 0,
routes: [{ name: "AccountSelector" }],
});
},
},
]);
setDisconnectPopup(true);
},
},
]
Expand Down Expand Up @@ -375,6 +362,69 @@ const Settings: Screen<"Settings"> = ({ route, navigation }) => {
</Text>
</Text>
</Reanimated.ScrollView>
<View
style={[
disconnectPopup ? {
display: "flex",
position: "absolute",
justifyContent: "center",
alignItems: "center",
zIndex: 1000,
top: 0,
left: 0,
right: 0,
bottom: 0,
} : {
display: "none"
}
]}
>
<Reanimated.View
style={{
height: 300,
width: "80%",
backgroundColor: "#ffffff",
borderRadius: 30,
shadowColor: "#000",
shadowOffset: {
width: 0,
height: 1,
},
justifyContent: "space-between",
shadowOpacity: 0.22,
shadowRadius: 2.22,
elevation: 3,
padding: 20,
}}
entering={FadeInDown}
exiting={FadeOutDown}
>
<View style={{ justifyContent: "center", alignItems: "center" }}>
<Text style={{ fontSize: 24 }}>Se déconnecter</Text>
<Text style={{ textAlign: "center", marginTop: 20 }}>
Êtes-vous sûr de vouloir vous déconnecter ?
</Text>
</View>
<View>
<ButtonCta
value={"Se déconnecter"}
onPress={() => {
removeAccount(account.localID);
navigation.reset({
index: 0,
routes: [{ name: "AccountSelector" }],
});
}}
/>
<ButtonCta
value={"Annuler"}
primary
onPress={() => setDisconnectPopup(false)}
style={{ marginTop: 10 }}
/>
</View>
</Reanimated.View>
</View>
</>
);
};
Expand Down