Skip to content

Commit

Permalink
fix: console errors
Browse files Browse the repository at this point in the history
  • Loading branch information
sanjaybaskaran01 committed Sep 5, 2021
1 parent e59ef5e commit 28f905d
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 16 deletions.
2 changes: 1 addition & 1 deletion public/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
}
],
"start_url": ".",
"display": "fullscreen",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#2a2b2e"
}
1 change: 1 addition & 0 deletions public/sw.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,4 @@ const networkAndCache = async (req) => {
return cached;
}
}

2 changes: 2 additions & 0 deletions src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ import Admin from "./pages/admin";
import AdminLogin from "./pages/admin/login";
import ThankYou from "./pages/Thankyou";
import Verify from "./pages/Verify";
import { RegisterSW } from "./components/serviceWorker";


function App() {
RegisterSW();
return (
<main>
<Switch>
Expand Down
3 changes: 1 addition & 2 deletions src/components/EventProfile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,11 @@ import { finalDate } from "./dateFormat";
import { AiOutlineCalendar } from "react-icons/ai";
import { FiUsers } from "react-icons/fi";
import { VscGlobe } from "react-icons/vsc";
import { isMobile } from "react-device-detect";

const EventProfile = ({img,org,title,desc,start,end,url,backgroundColor,textColor,todayChecker}) => {
start = new Date(start);
end = new Date(end);
let myRegexp=new RegExp("^(?:https?:\/\/)?(?:[^@\n]+@)?(?:www\.)?([^:\/\n?]+)")
let myRegexp=new RegExp("^(?:https?://)?(?:[^@]+@)?(?:www.)?([^:/?]+)")

let urlReg = myRegexp.exec(url);
return (
Expand Down
1 change: 1 addition & 0 deletions src/components/serviceWorker.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export const RegisterSW = async () =>{
if('serviceWorker' in navigator){
try{
console.log("Service worker launched")
await navigator.serviceWorker.register('./sw.js')
}catch(e)
{
Expand Down
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { BrowserRouter } from "react-router-dom";
ReactDOM.render(
<React.StrictMode>
<BrowserRouter>

<App />
</BrowserRouter>
</React.StrictMode>,
Expand Down
2 changes: 1 addition & 1 deletion src/pages/Eventform/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ const EventForm = () => {
</div>
<div className="flex sm:w-1/2 items-top">
<div className="w-full flex-row sm:flex-col">
<h2 class="preview mb-8">Preview</h2>
<h2 className="preview mb-8">Preview</h2>
<div className="eventprofile mb-8">
<EventProfile
todayChecker={true}
Expand Down
18 changes: 7 additions & 11 deletions src/pages/Home/index.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useState } from "react";
import React, { useState } from "react";
import FullCalendar from "@fullcalendar/react"; // must go before plugins
import dayGridPlugin from "@fullcalendar/daygrid"; // a plugin!
import interactionPlugin from "@fullcalendar/interaction";
Expand All @@ -9,7 +9,6 @@ import { useEffect } from "react";
import listPlugin from "@fullcalendar/list";
import { isMobile } from "react-device-detect";
import "./styles.css";
import { RegisterSW } from "../../components/serviceWorker";

const Home = () => {
const [showModal, setShowModal] = useState(false);
Expand All @@ -20,10 +19,10 @@ const Home = () => {
let path = "/addevent";
history.push(path);
};
const todayRouteChange = () =>{
const todayRouteChange = () => {
let path = "/today";
history.push(path);
}
};
const [finalDate, setFinalDate] = useState([]);
const [events, setEvents] = useState([]);

Expand All @@ -32,13 +31,12 @@ const Home = () => {
const AsyncEvent = async () => {
let res = await getMonth(finalDate);
setEvents(res);
RegisterSW();
};
AsyncEvent();
}
}, [finalDate]);
return (
<div className="md:mx-auto box" >
<div className="md:mx-auto box">
<FullCalendar
plugins={[dayGridPlugin, interactionPlugin, listPlugin]}
events={events}
Expand All @@ -65,9 +63,9 @@ const Home = () => {
setDate(current.date);
setShowModal(true);
}}
eventClick={(info)=>{
eventClick={(info) => {
info.jsEvent.preventDefault();
if(info.event.url){
if (info.event.url) {
window.open(info.event.url);
}
}}
Expand Down Expand Up @@ -98,10 +96,8 @@ const Home = () => {
const endDate = dateInfo.end;
endDate.setDate(endDate.getDate() - 1);
setFinalDate([dateInfo.start.toISOString(), endDate.toISOString()]);
}
}
}}
/>

{showModal ? <Modal closeModal={setShowModal} date={date} /> : null}
</div>
);
Expand Down
1 change: 0 additions & 1 deletion src/pages/Today/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import EventProfile from "../../components/EventProfile";
const Today = () => {

const [event, setEvent] = useState([]);
const todayChecker=true

useEffect(() => {
let date = new Date()
Expand Down

0 comments on commit 28f905d

Please sign in to comment.