Skip to content
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
41 changes: 41 additions & 0 deletions admin/public/offline.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Offline</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<style>
body {
font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
margin: 0;
background: #f9fafb;
color: #111827;
text-align: center;
}
.box {
max-width: 400px;
padding: 24px;
}
h1 {
font-size: 24px;
margin-bottom: 8px;
}
p {
color: #6b7280;
}
</style>
</head>
<body>
<div class="box">
<h1>You’re Offline</h1>
<p>
Please check your internet connection.<br />
The app will work again once you're online.
</p>
</div>
</body>
</html>
44 changes: 44 additions & 0 deletions admin/public/service-worker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
const CACHE_NAME = "saralseva-cache-v1";

const ASSETS_TO_CACHE = [
"/",
"/index.html",
"/offline.html",
];

// Install event – cache essential files
self.addEventListener("install", (event) => {
event.waitUntil(
caches.open(CACHE_NAME).then((cache) => {
return cache.addAll(ASSETS_TO_CACHE);
})
);
self.skipWaiting();
});

// Activate event – clean old caches
self.addEventListener("activate", (event) => {
event.waitUntil(
caches.keys().then((cacheNames) =>
Promise.all(
cacheNames.map((cache) => {
if (cache !== CACHE_NAME) {
return caches.delete(cache);
}
})
)
)
);
self.clients.claim();
});

// Fetch event – serve cached content when offline
self.addEventListener("fetch", (event) => {
event.respondWith(
fetch(event.request).catch(() =>
caches.match(event.request).then((response) => {
return response || caches.match("/offline.html");
})
)
);
});
16 changes: 15 additions & 1 deletion admin/src/main.jsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import React from "react";
import ReactDOM from "react-dom/client";
import { HelmetProvider } from "react-helmet-async";
import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
import App from "./App.jsx";
import "./index.css";
import { AdminProvider } from "./components/context/adminContext.jsx";


createRoot(document.getElementById("root")).render(
<StrictMode>
<HelmetProvider>
Expand All @@ -16,3 +16,17 @@ createRoot(document.getElementById("root")).render(
</HelmetProvider>
</StrictMode>
);

if ("serviceWorker" in navigator) {
window.addEventListener("load", () => {
navigator.serviceWorker
.register("/service-worker.js")
.then((registration) => {
console.log("Service Worker registered:", registration);
})
.catch((error) => {
console.error("Service Worker registration failed:", error);
});
});
}

41 changes: 41 additions & 0 deletions employee/public/offline.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Offline</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<style>
body {
font-family: system-ui, -apple-system, BlinkMacSystemFont, sans-serif;
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
margin: 0;
background: #f9fafb;
color: #111827;
text-align: center;
}
.box {
max-width: 400px;
padding: 24px;
}
h1 {
font-size: 24px;
margin-bottom: 8px;
}
p {
color: #6b7280;
}
</style>
</head>
<body>
<div class="box">
<h1>You’re Offline</h1>
<p>
Please check your internet connection.<br />
The app will work again once you're online.
</p>
</div>
</body>
</html>
44 changes: 44 additions & 0 deletions employee/public/service-worker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
const CACHE_NAME = "saralseva-cache-v1";

const ASSETS_TO_CACHE = [
"/",
"/index.html",
"/offline.html",
];

// Install event – cache essential files
self.addEventListener("install", (event) => {
event.waitUntil(
caches.open(CACHE_NAME).then((cache) => {
return cache.addAll(ASSETS_TO_CACHE);
})
);
self.skipWaiting();
});

// Activate event – clean old caches
self.addEventListener("activate", (event) => {
event.waitUntil(
caches.keys().then((cacheNames) =>
Promise.all(
cacheNames.map((cache) => {
if (cache !== CACHE_NAME) {
return caches.delete(cache);
}
})
)
)
);
self.clients.claim();
});

// Fetch event – serve cached content when offline
self.addEventListener("fetch", (event) => {
event.respondWith(
fetch(event.request).catch(() =>
caches.match(event.request).then((response) => {
return response || caches.match("/offline.html");
})
)
);
});
14 changes: 14 additions & 0 deletions employee/src/main.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from "react";
import ReactDOM from "react-dom/client";
import { HelmetProvider } from "react-helmet-async";
import { StrictMode } from "react";
import { createRoot } from "react-dom/client";
Expand All @@ -15,3 +16,16 @@ createRoot(document.getElementById("root")).render(
</HelmetProvider>
</StrictMode>
);

if ("serviceWorker" in navigator) {
window.addEventListener("load", () => {
navigator.serviceWorker
.register("/service-worker.js")
.then((registration) => {
console.log("Service Worker registered:", registration);
})
.catch((error) => {
console.error("Service Worker registration failed:", error);
});
});
}
15 changes: 11 additions & 4 deletions user/i18n.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
import i18n from "i18next";
import { initReactI18next } from "react-i18next";
import en from "./locales/en.json";
import hi from "./locales/hi.json";

import en from "../locales/en.json";
import hi from "../locales/hi.json";
import mr from "../locales/mr.json";
import gu from "../locales/gu.json";
import kn from "../locales/kn.json";

i18n.use(initReactI18next).init({
resources: {
en: { translation: en },
hi: { translation: hi },
mr: { translation: mr },
gu: { translation: gu },
kn: { translation: kn }
},
lng: localStorage.getItem("lang") || "en",
lng: "en",
fallbackLng: "en",
interpolation: { escapeValue: false },
interpolation: { escapeValue: false }
});

export default i18n;
21 changes: 16 additions & 5 deletions user/locales/en.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
{
"home": {
"welcome": "Welcome to SaralSeva",
"description": "Your one-stop solution for digital services.",
"navigation": {
"home": "Home",
"about": "About",
"schemes": "Schemes",
"askAI": "Ask AI",
"successStories": "Success Stories",
"dashboard": "Dashboard",
"grievances": "Grievances",
"contact": "Contact",
"login": "Login",
"register": "Register",
"logout": "Logout",
"language": "Language",
"contrast": "High Contrast Mode"
"myAccount": "My Account",
"profile": "Profile",
"schemeApplied": "Schemes Applied",
"grievancesApplied": "Grievances Applied",
"status": "Status",
"switchTheme": "Switch Theme"
}
}
21 changes: 21 additions & 0 deletions user/locales/gu.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"navigation": {
"home": "મુખ્ય પેજ",
"about": "અમારા વિશે",
"schemes": "યોજનાઓ",
"askAI": "એઆઈને પૂછો",
"successStories": "સફળતાની વાર્તાઓ",
"dashboard": "ડેશબોર્ડ",
"grievances": "ફરિયાદો",
"contact": "સંપર્ક કરો",
"login": "લોગિન",
"register": "રજીસ્ટર",
"logout": "લોગઆઉટ",
"myAccount": "મારું ખાતું",
"profile": "પ્રોફાઇલ",
"schemeApplied": "લાગુ કરેલી યોજનાઓ",
"grievancesApplied": "નોંધાયેલ ફરિયાદો",
"status": "સ્થિતિ",
"switchTheme": "થીમ બદલો"
}
}
21 changes: 16 additions & 5 deletions user/locales/hi.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
{
"home": {
"welcome": "सरलसेवा में आपका स्वागत है",
"description": "डिजिटल सेवाओं के लिए आपका एकमात्र समाधान।",
"navigation": {
"home": "होम",
"about": "हमारे बारे में",
"schemes": "योजनाएँ",
"askAI": "एआई से पूछें",
"successStories": "सफलता की कहानियाँ",
"dashboard": "डैशबोर्ड",
"grievances": "शिकायतें",
"contact": "संपर्क करें",
"login": "लॉगिन",
"register": "रजिस्टर",
"logout": "लॉगआउट",
"language": "भाषा",
"contrast": "हाई कॉन्ट्रास्ट मोड"
"myAccount": "मेरा खाता",
"profile": "प्रोफ़ाइल",
"schemeApplied": "लागू की गई योजनाएँ",
"grievancesApplied": "दर्ज की गई शिकायतें",
"status": "स्थिति",
"switchTheme": "थीम बदलें"
}
}
21 changes: 21 additions & 0 deletions user/locales/kn.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"navigation": {
"home": "ಮುಖಪುಟ",
"about": "ನಮ್ಮ ಬಗ್ಗೆ",
"schemes": "ಯೋಜನೆಗಳು",
"askAI": "ಎಐಗೆ ಕೇಳಿ",
"successStories": "ಯಶಸ್ಸಿನ ಕಥೆಗಳು",
"dashboard": "ಡ್ಯಾಶ್‌ಬೋರ್ಡ್",
"grievances": "ದೂರುಗಳು",
"contact": "ಸಂಪರ್ಕಿಸಿ",
"login": "ಲಾಗಿನ್",
"register": "ನೋಂದಣಿ",
"logout": "ಲಾಗ್‌ಔಟ್",
"myAccount": "ನನ್ನ ಖಾತೆ",
"profile": "ಪ್ರೊಫೈಲ್",
"schemeApplied": "ಅರ್ಜಿಸಿದ ಯೋಜನೆಗಳು",
"grievancesApplied": "ಅರ್ಜಿಸಿದ ದೂರುಗಳು",
"status": "ಸ್ಥಿತಿ",
"switchTheme": "ಥೀಮ್ ಬದಲಿಸಿ"
}
}
21 changes: 21 additions & 0 deletions user/locales/mr.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"navigation": {
"home": "मुख्यपृष्ठ",
"about": "आमच्याबद्दल",
"schemes": "योजना",
"askAI": "एआयला विचारा",
"successStories": "यशोगाथा",
"dashboard": "डॅशबोर्ड",
"grievances": "तक्रारी",
"contact": "संपर्क",
"login": "लॉगिन",
"register": "नोंदणी करा",
"logout": "लॉगआउट",
"myAccount": "माझे खाते",
"profile": "प्रोफाइल",
"schemeApplied": "अर्ज केलेल्या योजना",
"grievancesApplied": "नोंदवलेल्या तक्रारी",
"status": "स्थिती",
"switchTheme": "थीम बदला"
}
}
Loading
Loading