-
-
Save okoghenun/20d766a61fe8ea1c0ce189108681da97 to your computer and use it in GitHub Desktop.
import React, { Component } from 'react'; | |
import { Switch, Route } from 'react-router-dom'; | |
import { Routes } from './config/routes'; | |
import './App.css'; | |
class App extends Component { | |
render() { | |
return ( | |
<section> | |
<Switch> | |
{Routes.map((route, index) => [ | |
<Route | |
key={index} | |
path={route.path} | |
exact={route.exact} | |
component={route.component} | |
/> | |
])} | |
</Switch> | |
</section> | |
); | |
} | |
} | |
export default App; |
import React, { Component } from 'react'; | |
import logo from '../logo.svg'; | |
class About extends Component { | |
render() { | |
return ( | |
<div className="App"> | |
<header className="App-header"> | |
<img src={logo} className="App-logo" alt="logo" /> | |
<h1 className="App-title">About Page</h1> | |
</header> | |
<p className="App-intro"> | |
Welcome to the about page :) | |
</p> | |
</div> | |
); | |
} | |
} | |
export default About; |
import React, { Component } from 'react'; | |
import logo from '../logo.svg'; | |
class Home extends Component { | |
render() { | |
return ( | |
<div className="App"> | |
<header className="App-header"> | |
<img src={logo} className="App-logo" alt="logo" /> | |
<h1 className="App-title">Home Page</h1> | |
</header> | |
<p className="App-intro"> | |
Welcome to the home page :) | |
</p> | |
</div> | |
); | |
} | |
} | |
export default Home; |
import Home from '../components/Home'; | |
import About from '../components/About'; | |
export const Routes = [ | |
{ | |
path: '/', | |
exact: true, | |
component: Home | |
}, | |
{ | |
path: '/about-us', | |
exact: false, | |
component: About | |
}, | |
]; |
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
import './index.css'; | |
import App from './App'; | |
import registerServiceWorker from './registerServiceWorker'; | |
import { BrowserRouter } from 'react-router-dom'; | |
ReactDOM.render(<BrowserRouter><App /></BrowserRouter>, document.getElementById('root')); | |
registerServiceWorker(); |
import { useState } from "react";
import { Table, Button, Input } from "@/components/ui";
const clients = [
{ id: 1, name: "AGUILAR TAFUR WILLIAM ANDRES", city: "Piedecuesta", contact: "[email protected]", status: "Pendiente" },
{ id: 2, name: "MENESES SAENZ DAVID ALEJANDRO", city: "Velez", contact: "[email protected]", status: "En Proceso" },
{ id: 3, name: "GARCIA SANABRIA RICARDO ARNULFO", city: "Bucaramanga", contact: "[email protected]", status: "Cerrado" },
];
export default function CRM() {
const [data, setData] = useState(clients);
const [search, setSearch] = useState("");
const handleSearch = (e) => {
setSearch(e.target.value);
};
return (
CRM - Gestión de Clientes
{data
.filter(client => client.name.toLowerCase().includes(search.toLowerCase()))
.map(client => (
))}
Nombre | Ciudad | Contacto | Estado | Acciones |
---|---|---|---|---|
{client.name} | {client.city} | {client.contact} | {client.status} | Editar Eliminar |
);
}
import { useState } from "react";
import { Table, Button, Input } from "@/components/ui";
const clients = [
{ id: 1, name: "AGUILAR TAFUR WILLIAM ANDRES", city: "Piedecuesta", contact: "[email protected]", status: "Pendiente" },
{ id: 2, name: "MENESES SAENZ DAVID ALEJANDRO", city: "Velez", contact: "[email protected]", status: "En Proceso" },
{ id: 3, name: "GARCIA SANABRIA RICARDO ARNULFO", city: "Bucaramanga", contact: "[email protected]", status: "Cerrado" },
];
export default function CRM() {
const [data, setData] = useState(clients);
const [search, setSearch] = useState("");
const handleSearch = (e) => {
setSearch(e.target.value);
};
return (
CRM - Gestión de Clientes
{data
.filter(client => client.name.toLowerCase().includes(search.toLowerCase()))
.map(client => (
))}
Nombre | Ciudad | Contacto | Estado | Acciones |
---|---|---|---|---|
{client.name} | {client.city} | {client.contact} | {client.status} | Editar Eliminar |
);
}
import React, { useState } from 'react';
const EmergencyAlertApp = () => {
const [loading, setLoading] = useState(false);
const handleEmergencyAlert = async () => {
setLoading(true);
try {
const position = await getCurrentLocation();
await sendAlertToHospitals(position);
alert('Emergency Alert Sent Successfully!');
} catch (error) {
alert('Failed to send alert');
}
setLoading(false);
};
const getCurrentLocation = () => {
return new Promise((resolve, reject) => {
navigator.geolocation.getCurrentPosition(
(position) => resolve(position.coords),
(error) => reject(error)
);
});
};
const sendAlertToHospitals = async (coords) => {
// Replace with actual API call
console.log(Alert sent with location: ${coords.latitude}, ${coords.longitude}
);
};
return (
<div style={{ textAlign: 'center', marginTop: '20%' }}>
Emergency Alert System
<button onClick={handleEmergencyAlert} disabled={loading} style={{ padding: '10px 20px', fontSize: '20px' }}>
{loading ? 'Sending Alert...' : 'Send Emergency Alert'}
);
};
export default EmergencyAlertApp;
import CRM from "./CRM";
function App() {
return (
);
}
export default App;