-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
130 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
chatbot |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+645 KB
VolunteeringUkraineMap/public/images/popup/Lviv_Camouflage_Netting.jpeg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
{ | ||
/* Visit https://firebase.google.com/docs/database/security to learn more about security rules. */ | ||
"rules": { | ||
".read": false, | ||
".write": false | ||
".read": true, | ||
".write": true | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,9 @@ | ||
<template> | ||
<Adminpanel/> | ||
<MapComponent/> | ||
</template> | ||
|
||
<script setup> | ||
import MapComponent from './components/VolunteerUkraineMap.vue'; | ||
import Adminpanel from "./components/Adminpanel.vue"; | ||
</script> |
57 changes: 57 additions & 0 deletions
57
VolunteeringUkraineUserGeneratedMap/src/components/Adminpanel.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<!-- src/components/Admin.vue --> | ||
<template> | ||
<div v-if="isAdmin"> | ||
<!-- Admin functionalities here --> | ||
<h1>Admin Panel</h1> | ||
<form @submit.prevent="addMarker"> | ||
<label for="lat">Latitude:</label> | ||
<input type="number" id="lat" v-model="newMarker.lat" step="any" required /> | ||
|
||
<label for="lng">Longitude:</label> | ||
<input type="number" id="lng" v-model="newMarker.lng" step="any" required /> | ||
|
||
<button type="submit">Add Marker</button> | ||
</form> | ||
</div> | ||
<div v-else> | ||
<button @click="signIn">Sign In</button> | ||
</div> | ||
</template> | ||
|
||
<script setup> | ||
import { ref } from 'vue'; | ||
import { signInWithPopup, GoogleAuthProvider, onAuthStateChanged } from "firebase/auth"; | ||
import { getDatabase, ref as dbRef, push } from "firebase/database"; | ||
import { auth } from '../firebaseConfig'; | ||
|
||
const isAdmin = ref(false); | ||
const newMarker = ref({ lat: 0, lng: 0 }); | ||
|
||
onAuthStateChanged(auth, (user) => { | ||
if (user) { | ||
// Check if the user is an admin (replace with your own logic) | ||
isAdmin.value = user.email === '[email protected]'; | ||
} else { | ||
isAdmin.value = false; | ||
} | ||
}); | ||
|
||
const db = getDatabase(); | ||
const markersRef = dbRef(db, 'markers'); | ||
|
||
const addMarker = () => { | ||
// Add new marker to Firebase Realtime Database | ||
push(markersRef, newMarker.value); | ||
// Reset the form | ||
newMarker.value = { lat: 0, lng: 0 }; | ||
}; | ||
|
||
const signIn = async () => { | ||
const provider = new GoogleAuthProvider(); | ||
await signInWithPopup(auth, provider); | ||
}; | ||
|
||
signIn().catch((error) => { | ||
console.error("Sign-in error", error); | ||
}); | ||
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters