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

State dashboard #188

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: 2.1

orbs:
aws-ecr: circleci/[email protected]
aws-eks: circleci/aws-eks@0.2.6
aws-eks: circleci/aws-eks@1.2.0

workflows:
deploy-to-production:
Expand Down
10 changes: 5 additions & 5 deletions src/components/Sidebar/SidebarContent.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,28 +44,28 @@ function SidebarContent() {
<ul className="px-6 space-y-1">
<ul className="flex text-sm space-x-2">
<li>
<a href="https://github.com/coronasafe/dashboard">Github</a>
<a href="https://github.com/tncwr/dashboard">Github</a>
</li>
<li>
<a href="https://github.com/coronasafe/dashboard/issues">Issues</a>
<a href="https://github.com/tncwr/dashboard/issues">Issues</a>
</li>
<li>
<a href="https://coronasafe.network/volunteer">Volunteer</a>
<a href="https://github.com/tncwr">GitHub</a>
</li>
<li>
<a href="mailto:[email protected]">Contact</a>
</li>
</ul>
<li className="flex flex-col">
<a
href="https://coronasafe.network/"
href="https://github.com/tncwr/"
className="inline-flex text-xs space-x-1"
>
<span>Copyright © 2021</span>
<CoronaSafeLogo className="h-4" aria-hidden="true" />
</a>
<a
href="https://github.com/coronasafe/dashboard/blob/master/LICENSE"
href="https://github.com/tncwr/dashboard/blob/master/LICENSE"
className="text-xxs"
>
Released under the MIT License
Expand Down
6 changes: 3 additions & 3 deletions src/pages/DistrictDashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function DistrictDashboard() {
const params = useParams();
const [isOpen, setIsOpen] = useState(false);
const [timeseries, setTimeseries] = useState(false);
const [filterDistrict, setFilterDistrict] = useState(ACTIVATED_DISTRICTS[0]);
const [filterDistrict, setFilterDistrict] = useState(ACTIVATED_DISTRICTS[1]);
const [filterFacilityTypes, setFilterFacilityTypes] =
useState(FACILITY_TYPES);
const [content, setContent] = useState(
Expand All @@ -66,7 +66,7 @@ function DistrictDashboard() {
(district) => district.name.toLowerCase() === name?.toLowerCase()
);

return district === undefined ? ACTIVATED_DISTRICTS[0] : district;
return district === undefined ? ACTIVATED_DISTRICTS[1] : district;
};

useEffect(() => {
Expand Down Expand Up @@ -200,7 +200,7 @@ function DistrictDashboard() {
});
return (
<div className="overflow-hidden md:overflow-auto">
<PageTitle>District Dashboard</PageTitle>
<PageTitle>State Dashboard</PageTitle>
<div className="flex flex-col items-center justify-between mb-2 px-4 py-2 bg-primary-500 rounded-lg shadow-md md:flex-row">
<p className="text-white font-semibold">{filterDistrict.name}</p>
<div className="md:flex md:space-x-2">
Expand Down
12 changes: 2 additions & 10 deletions src/routes/sidebar.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const routes = [
{
name: "District Dashboard",
name: "State Dashboard",
routes: [
{
path: "/district/capacity",
Expand All @@ -25,17 +25,9 @@ const routes = [
],
},
{
href: "https://care.coronasafe.network/",
href: "https://care.tncwr.in/",
name: "Care",
},
{
href: "https://kerala.coronasafe.network/",
name: "Kerala Dashboard",
},
{
href: "https://kerala.coronasafe.network/hotspots",
name: "Kerala Dashboard: Hotspots",
},
];

export default routes;
30 changes: 21 additions & 9 deletions src/utils/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,27 @@ export function careSummary(
district,
limit = 2000
) {
return fetch(
`/api/v1/${type}_summary/?` +
new URLSearchParams({
start_date,
end_date,
district,
limit,
})
).then((r) => r.json());
if (district == 99) {
return fetch(
`/api/v1/${type}_summary/?` +
new URLSearchParams({
start_date,
end_date,
state: 2,
limit,
})
).then((r) => r.json());
} else {
return fetch(
`/api/v1/${type}_summary/?` +
new URLSearchParams({
start_date,
end_date,
district,
limit,
})
).then((r) => r.json());
}
}

export function individualCareSummary(type, start_date, end_date, facility) {
Expand Down
48 changes: 46 additions & 2 deletions src/utils/constants.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,53 @@
// Activated Districts
export const ACTIVATED_DISTRICTS = [
{ id: 7, name: "Ernakulam", lat: 10.148_547_6, lng: 76.500_752_4, zoom: 10 },
{ id: "99", name: "Tamilnadu", lat: "13.266", lng: "79.9963", zoom: 10 },
{ id: "15", name: "Tiruvallur", lat: "13.266", lng: "79.9331", zoom: 10 },
{ id: "16", name: "Chennai", lat: "13.0629", lng: "80.2315", zoom: 10 },
{ id: "17", name: "Kancheepuram", lat: "12.833", lng: "79.8386", zoom: 10 },
{ id: "18", name: "Vellore", lat: "12.901", lng: "78.9493", zoom: 10 },
{ id: "19", name: "Dharmapuri", lat: "12.1005", lng: "78.1932", zoom: 10 },
{ id: "20", name: "Tiruvannamalai", lat: "12.489", lng: "79.1665", zoom: 10 },
{ id: "21", name: "Villupuram", lat: "12.1237", lng: "79.529", zoom: 10 },
{ id: "22", name: "Salem", lat: "11.6773", lng: "78.2222", zoom: 10 },
{ id: "23", name: "Namakkal", lat: "11.3187", lng: "78.1357", zoom: 10 },
{ id: "24", name: "Erode", lat: "11.5177", lng: "77.4129", zoom: 10 },
{ id: "25", name: "The Nilgiris", lat: "11.4573", lng: "76.6403", zoom: 10 },
{ id: "26", name: "Coimbatore", lat: "10.8777", lng: "76.9766", zoom: 10 },
{ id: "27", name: "Dindigul", lat: "10.392", lng: "77.82", zoom: 10 },
{ id: "28", name: "Karur", lat: "10.899", lng: "78.1343", zoom: 10 },
{ id: "29", name: "Tiruchirapalli", lat: "10.98", lng: "78.5703", zoom: 10 },
{ id: "30", name: "Perambalur", lat: "11.2749", lng: "78.8919", zoom: 10 },
{ id: "31", name: "Ariyalur", lat: "11.1624", lng: "79.2441", zoom: 10 },
{ id: "32", name: "Cuddalore", lat: "11.5354", lng: "79.45", zoom: 10 },
{ id: "33", name: "Nagapattinam", lat: "10.5741", lng: "79.7624", zoom: 10 },
{ id: "34", name: "Tiruvarur", lat: "10.6754", lng: "79.5335", zoom: 10 },
{ id: "35", name: "Thanjavur", lat: "10.6702", lng: "79.2406", zoom: 10 },
{ id: "36", name: "Pudukkottai", lat: "10.3602", lng: "78.8792", zoom: 10 },
{ id: "37", name: "Sivagangai", lat: "9.91436", lng: "78.5966", zoom: 10 },
{ id: "38", name: "Madurai", lat: "9.92266", lng: "78.0057", zoom: 10 },
{ id: "39", name: "Theni", lat: "9.89215", lng: "77.4387", zoom: 10 },
{ id: "40", name: "Virudhunagar", lat: "9.4925", lng: "77.9052", zoom: 10 },
{ id: "41", name: "Ramanathapuram", lat: "9.376", lng: "78.6869", zoom: 10 },
{ id: "42", name: "Thoothukudi", lat: "8.90295", lng: "77.9979", zoom: 10 },
{ id: "43", name: "Tirunelveli", lat: "8.57863", lng: "77.6028", zoom: 10 },
{ id: "44", name: "Kanniyakumari", lat: "8.30789", lng: "77.3598", zoom: 10 },
{ id: "45", name: "Krishnagiri", lat: "12.646", lng: "78.0313", zoom: 10 },
{ id: "46", name: "Tiruppur", lat: "10.8393", lng: "77.4081", zoom: 10 },
{ id: "47", name: "Ranipet", lat: "12.95", lng: "79.4618", zoom: 10 },
{ id: "48", name: "Kallakurichi", lat: "11.7982", lng: "79.0126", zoom: 10 },
{ id: "49", name: "Tirupathur", lat: "12.5733", lng: "78.6406", zoom: 10 },
{ id: "50", name: "Tenkasi", lat: "9.07795", lng: "77.4463", zoom: 10 },
{ id: "51", name: "Chengalpattu", lat: "12.5714", lng: "79.9963", zoom: 10 },
{
id: "53",
name: "Mayiladuthurai",
lat: "11.1529",
lng: "79.7096",
zoom: 10,
},
];

export const GMAP_KEY = "AIzaSyDsBAc3y7deI5ZO3NtK5GuzKwtUzQNJNUk";
export const GMAP_KEY = "AIzaSyCd-dCJ0kZggouOsYQ9onr87k03CnZxUOg";

export const AVAILABILITY_TYPES_ORDERED = [
1, 150, 10, 20, 30, 120, 110, 100, 40, 60, 50, 70,
Expand Down