Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
  • Loading branch information
fgerards committed Oct 14, 2023
1 parent a59225a commit 9d90f39
Show file tree
Hide file tree
Showing 11 changed files with 130 additions and 8 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
chatbot
1 change: 0 additions & 1 deletion .idea/misc.xml

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

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.
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.
62 changes: 62 additions & 0 deletions VolunteeringUkraineMap/src/assets/markers.json
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,68 @@
}
]
},
{
"name": "Kyiv Kitchen Hub \"Ants\"",
"category": "Preparation of dehydrated ready meals for soldiers on the frontline",
"bgImg": "/images/popup/Kyiv_Kitchen_Ants.png",
"url": "https://www.volunteeringukraine.com/volunteer-opportunities/kyiv-kitchen-ants",
"positions": [
{
"city": "Kyiv oblast",
"lat": 50.5034664,
"lng": 30.5501114
}
]
},
{
"name": "Lviv Camouflage Netting",
"category": "Crafting camouflage nets to protect soldiers at the frontline.",
"bgImg": "/images/popup/Lviv_Camouflage_Netting.jpeg",
"url": "https://www.volunteeringukraine.com/volunteer-opportunities/lviv-camouflage-netting",
"positions": [
{
"city": "Lviv",
"lat": 49.832689,
"lng": 24.0122355
}
]
},
{
"name": "“Free Land” program",
"category": "Demining territories in Ukraine, environmental cleanup, and organizing practical courses on handling explosive ordnance for specialized professionals and volunteers.",
"bgImg": "/images/popup/Free_Land_Program.jpeg",
"url": "https://www.volunteeringukraine.com/volunteer-opportunities/charitable-organization-bank-lviv-charitable-fund",
"positions": [
{
"city": "Lviv",
"lat": 49.8415405,
"lng": 24.0329847
}
]
},
{
"name": "NGO \"Ukraine is Europe\"",
"category": "Sending humanitarian convoys and ambulances to conflict zones, providing vital supplies and support",
"bgImg": "/images/popup/NGO_Ukraine_is_Europe.png",
"url": "https://www.volunteeringukraine.com/volunteer-opportunities/ukraine-is-europe",
"positions": [
{
"city": "Lviv",
"lat": 49.8327705,
"lng": 23.9296644
},
{
"city": "Dnipro",
"lat": 48.462408,
"lng": 34.83521
},
{
"city": "Kharkiv",
"lat": 49.9946724,
"lng": 36.2032536
}
]
},
{
"name": "Pasta Cafe",
"category": "Package dinners for IDP / Dry meal plan for soldiers",
Expand Down
7 changes: 3 additions & 4 deletions VolunteeringUkraineUserGeneratedMap/database.rules.json
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
}
}
}
2 changes: 2 additions & 0 deletions VolunteeringUkraineUserGeneratedMap/src/App.vue
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 VolunteeringUkraineUserGeneratedMap/src/components/Adminpanel.vue
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>
8 changes: 5 additions & 3 deletions VolunteeringUkraineUserGeneratedMap/src/firebaseConfig.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// src/firebaseConfig.js
import { initializeApp } from "firebase/app";
import { getDatabase } from "firebase/database";
import {initializeApp} from "firebase/app";
import {getDatabase} from "firebase/database";
import {getAuth} from "firebase/auth";

const firebaseConfig = {
apiKey: "AIzaSyA-eFJFdEXQ6yynTcCXRxRwMQwFEMuBZyU",
Expand All @@ -14,5 +15,6 @@ const firebaseConfig = {

const app = initializeApp(firebaseConfig);
const db = getDatabase(app);
const auth = getAuth(app);

export { db };
export {db, auth};

0 comments on commit 9d90f39

Please sign in to comment.