refactor: everything #61
@@ -80,7 +80,7 @@
|
|||||||
}}
|
}}
|
||||||
class="feedbackContainer"
|
class="feedbackContainer"
|
||||||
>
|
>
|
||||||
<h1 class="submitHeader">Submit Feedback</h1>
|
<h1 class="submitHeader">Update Tags</h1>
|
||||||
|
|
||||||
<div class="compulsoryTags">
|
<div class="compulsoryTags">
|
||||||
<div class="compulsoryContainer">
|
<div class="compulsoryContainer">
|
||||||
|
|||||||
@@ -114,7 +114,7 @@
|
|||||||
|
|
||||||
.compulsoryContainer {
|
.compulsoryContainer {
|
||||||
display: grid;
|
display: grid;
|
||||||
grid-template-columns: repeat(auto-fit, minmax(3.75rem, 1fr));
|
grid-template-columns: repeat(auto-fit, minmax(3.7rem, 1fr));
|
||||||
gap: 0.3rem;
|
gap: 0.3rem;
|
||||||
font-size: 0.8rem;
|
font-size: 0.8rem;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ export const availableStudySpaceTags = [
|
|||||||
"Air conditioned",
|
"Air conditioned",
|
||||||
"Cold",
|
"Cold",
|
||||||
"PCs",
|
"PCs",
|
||||||
"Cringe"
|
"Rodent-ridden"
|
||||||
];
|
];
|
||||||
|
|
||||||
export const volumeTags = ["Silent", "Some Noise", "Loud"];
|
export const volumeTags = ["Silent", "Some Noise", "Loud"];
|
||||||
|
|||||||
@@ -99,6 +99,33 @@
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const sortedByOpenNow = $derived(
|
||||||
|
filteredStudySpaces.toSorted((a, b) => {
|
||||||
|
const now = new Date();
|
||||||
|
const time = now.toTimeString().slice(0, 5);
|
||||||
|
const today = now.getDay();
|
||||||
|
let openUntil = [0, 0] as number[];
|
||||||
|
for (const [index, day] of [a, b].entries()) {
|
||||||
|
const timingsPerDay = collectTimings(day.study_space_hours);
|
||||||
|
for (const timing of timingsPerDay[today]) {
|
||||||
|
if (timing.open_today_status === true) {
|
||||||
|
openUntil[index] = 24 * 60;
|
||||||
|
break;
|
||||||
|
} else if (timing.open_today_status === false) {
|
||||||
|
break;
|
||||||
|
} else {
|
||||||
|
const opensFor = timeUntilClosing(timing.opens_at, timing.closes_at, time);
|
||||||
|
if (opensFor) {
|
||||||
|
openUntil[index] = opensFor;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return openUntil[1] - openUntil[0];
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
const sortedStudySpaces = $derived(
|
const sortedStudySpaces = $derived(
|
||||||
sortNear
|
sortNear
|
||||||
? filteredStudySpaces.toSorted((a, b) => {
|
? filteredStudySpaces.toSorted((a, b) => {
|
||||||
@@ -122,7 +149,7 @@
|
|||||||
);
|
);
|
||||||
return aDistance - bDistance;
|
return aDistance - bDistance;
|
||||||
})
|
})
|
||||||
: filteredStudySpaces
|
: sortedByOpenNow
|
||||||
);
|
);
|
||||||
|
|
||||||
// Open now
|
// Open now
|
||||||
@@ -170,10 +197,18 @@
|
|||||||
<a href="/space/new/edit">
|
<a href="/space/new/edit">
|
||||||
<img src={crossUrl} alt="new" class="new-space" />
|
<img src={crossUrl} alt="new" class="new-space" />
|
||||||
</a>
|
</a>
|
||||||
|
{/if}
|
||||||
|
{#if adminMode}
|
||||||
|
<span class="checkReports">
|
||||||
|
<Button href="/space/reports" type="link" style="red">Check Reports</Button>
|
||||||
|
</span>
|
||||||
|
{/if}
|
||||||
|
{#if session}
|
||||||
<button class="fav-button" onclick={() => (showFavourites = !showFavourites)} type="button">
|
<button class="fav-button" onclick={() => (showFavourites = !showFavourites)} type="button">
|
||||||
{showFavourites ? "All spaces" : "My favourites"}
|
{showFavourites ? "All spaces" : "My favourites"}
|
||||||
</button>
|
</button>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<div class="filterWrapper">
|
<div class="filterWrapper">
|
||||||
<Button type="link" href="/filter?{searchParams}">
|
<Button type="link" href="/filter?{searchParams}">
|
||||||
<span class="search">
|
<span class="search">
|
||||||
@@ -185,11 +220,6 @@
|
|||||||
</Navbar>
|
</Navbar>
|
||||||
|
|
||||||
<main>
|
<main>
|
||||||
{#if adminMode}
|
|
||||||
<div class="checkReports">
|
|
||||||
<Button href="/space/reports" type="link" style="red">Check Reports</Button>
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
{#each sortedStudySpaces as studySpace (studySpace.id)}
|
{#each sortedStudySpaces as studySpace (studySpace.id)}
|
||||||
{@const imgUrl =
|
{@const imgUrl =
|
||||||
studySpace.study_space_images.length > 0
|
studySpace.study_space_images.length > 0
|
||||||
@@ -256,7 +286,8 @@
|
|||||||
grid-column: 1 / -1;
|
grid-column: 1 / -1;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
font-size: 1.2rem;
|
font-size: 1rem;
|
||||||
|
margin-left: 0.5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.fav-button {
|
.fav-button {
|
||||||
|
|||||||
@@ -68,8 +68,8 @@
|
|||||||
const { Map } = await loader.importLibrary("maps");
|
const { Map } = await loader.importLibrary("maps");
|
||||||
const { AdvancedMarkerElement } = await loader.importLibrary("marker");
|
const { AdvancedMarkerElement } = await loader.importLibrary("marker");
|
||||||
const map = new Map(sortMapElem, {
|
const map = new Map(sortMapElem, {
|
||||||
center: { lat: 53.6, lng: -1.56 },
|
center: { lat: 51.5087393, lng: -0.1667442 },
|
||||||
zoom: 5,
|
zoom: 10,
|
||||||
mapId: "9f4993cd3fb1504d495821a5"
|
mapId: "9f4993cd3fb1504d495821a5"
|
||||||
});
|
});
|
||||||
marker = new AdvancedMarkerElement({
|
marker = new AdvancedMarkerElement({
|
||||||
|
|||||||
@@ -187,7 +187,7 @@
|
|||||||
isFeedbackPromptVisible = true;
|
isFeedbackPromptVisible = true;
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
Help categorise this space
|
Update Tags
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
|
|||||||
Reference in New Issue
Block a user