Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/SEP4Y-S24/frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
gramovi4a committed May 27, 2024
2 parents 4db394e + b070df5 commit b427c8a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 9 deletions.
2 changes: 1 addition & 1 deletion src/components/Form/selectForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export default function Dropdown({
leaveFrom="opacity-100"
leaveTo="opacity-0"
>
<Listbox.Options className="absolute z-10 mt-1 max-h-56 w-full overflow-auto rounded-md bg-white py-1 text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm">
<Listbox.Options className="relative z-10 mt-1 max-h-56 w-full overflow-auto rounded-md bg-white py-1 text-base shadow-lg ring-1 ring-black ring-opacity-5 focus:outline-none sm:text-sm">
{options.map((element) => (
<Listbox.Option
key={element.id}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Layout/MainLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ type MobileSidebarProps = {
};
//Get the clock from the storage :

const clockData : {name : string, clockId : string} = storage.getClock() ? storage.getClock() : {name : "No clock selected", clockId : "SELECTACLOCK"}
const clockData : {name : string, clockId : string} = storage.getClock() ? storage.getClock() : {name : "No clock selected", clockId : "Select a clock"}

const MobileSidebar = ({sidebarOpen, setSidebarOpen}: MobileSidebarProps) => {
return (
Expand Down
13 changes: 10 additions & 3 deletions src/pages/Settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,18 @@ export const Settings = () => {
name: "Select",
});


const changeClockOnStorage =(value : {id: string; name: string })=>{
const clockToSet = {
clockId: value.id,
name: value.name
}
storage.setClock(clockToSet)
window.location.reload()
setSelectedClock(value)
storage.setClock(selectedClock)
}


useEffect(() => {
const fetchData = async () => {
try {
Expand Down Expand Up @@ -51,9 +58,9 @@ export const Settings = () => {
<SelectForm
dropdownLabel="Select a clock"
options={clocks}
className="mb-5 z-50 relative"
className="mb-5 z-50 "
value={selectedClock}
onChange={() => changeClockOnStorage(selectedClock)}
onChange={(newValue : any) => changeClockOnStorage(newValue)}
/>
) : (
<Heading text={"No clocks have been added yet"} type={"heading4"} />
Expand Down
8 changes: 4 additions & 4 deletions src/routes/protected.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ const { Categories } = lazyImport(
const { Alarm } = lazyImport(() => import("../pages/Alarm"), "Alarm");

const App = () => {
// const user = storage.getUser();
// if (!user) {
// return <Navigate to="/auth/login" />;
// }
const user = storage.getUser();
if (!user) {
return <Navigate to="/auth/login" />;
}
return (
<MainLayout>
<Outlet />
Expand Down

0 comments on commit b427c8a

Please sign in to comment.