Skip to content

Commit

Permalink
Merge pull request #299 from Do-Good-Get-Good/open_chat_for_all
Browse files Browse the repository at this point in the history
open chat for everyone. updating react native
  • Loading branch information
covetous authored Jun 25, 2024
2 parents faa9bc9 + 0146595 commit bfac658
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 27 deletions.
8 changes: 4 additions & 4 deletions src/components/Alerts/AlertQuestion .tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ export const AlertQuestion = (
onPressNo?: () => void,
) =>
Alert.alert(title, question, [
{
text: "Nej",
onPress: onPressNo,
},
{
text: "Ja",
onPress: () => onPressYes(),
},
{
text: "Nej",
onPress: onPressNo,
},
]);
18 changes: 7 additions & 11 deletions src/components/MenuOverlay/MenuOverlay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,13 @@ export const MenuOverlay = ({ openOverlay, isVisible }: Props) => {
</TouchableOpacity>
<View style={styles.menuOverlay}>
<View style={styles.menuOverlayItemStyling}>
{menuNavigation?.map((item, i) =>
Config.NODE_ENV === "prod" &&
userEmail !== "[email protected]" &&
item.screenName === UserStack.Chat ? null : (
<MenuLink
key={item.screenName + i}
openOverlay={openOverlay}
navigationObj={item}
/>
),
)}
{menuNavigation?.map((item, i) => (
<MenuLink
key={item.screenName + i}
openOverlay={openOverlay}
navigationObj={item}
/>
))}
</View>

<MenuFooter
Expand Down
9 changes: 5 additions & 4 deletions src/package-lock.json

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

2 changes: 1 addition & 1 deletion src/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"mobx-react-lite": "^4.0.3",
"react": "18.2.0",
"react-hook-form": "^7.49.2",
"react-native": "^0.73.6",
"react-native": "^0.73.8",
"react-native-bouncy-checkbox": "^3.0.7",
"react-native-calendars": "^1.1293.0",
"react-native-config": "^1.5.0",
Expand Down
23 changes: 16 additions & 7 deletions src/screens/Chat/useUserPostsActions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ import { AlertQuestion } from "../../components/Alerts/AlertQuestion ";
import { updatePostInFirestore } from "../../firebase-functions/updateTS/update";

const alertMessage =
"Vill du publicera det här inlägget i chatten? Alla DGGG-användare kommer att se detta inlägg. nlägget raderas automatiskt efter ett år.";

"Vill du publicera det här inlägget i chatten? Alla DGGG-användare kommer att se detta inlägg. Inlägget raderas automatiskt efter ett år.";

const alertUpdateMessage= "Vill du spara ändringarna."
const alertUpdateMessage = "Vill du spara ändringarna.";

export const useUserPostsActions = () => {
const [loading, setLoading] = useState(false);
Expand All @@ -29,16 +28,26 @@ export const useUserPostsActions = () => {
});
setLoading(false);
};
const onUpdateRequest = async (post: UserPost,updatedImage: UserPost['imageURL'], afterPostUpdated?: () => void) => {
const onUpdateRequest = async (
post: UserPost,
updatedImage: UserPost["imageURL"],
afterPostUpdated?: () => void,
) => {
setLoading(true);

await updatePostInFirestore(post, updatedImage).then(() => {
afterPostUpdated && afterPostUpdated();
});
setLoading(false);
};
const updatePost = async (post: UserPost,updatedImage: UserPost['imageURL'], afterPostUpdated?: () => void) => {
AlertQuestion("", alertUpdateMessage, () => onUpdateRequest(post,updatedImage, afterPostUpdated));
const updatePost = async (
post: UserPost,
updatedImage: UserPost["imageURL"],
afterPostUpdated?: () => void,
) => {
AlertQuestion("", alertUpdateMessage, () =>
onUpdateRequest(post, updatedImage, afterPostUpdated),
);
};

const addPost = async (post: UserPost, afterPostAdded?: () => void) => {
Expand Down

0 comments on commit bfac658

Please sign in to comment.