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

23/minor-changes #26

Merged
merged 51 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from 41 commits
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
1686299
updating chips
acholyn Nov 21, 2024
0882422
Merge pull request #21 from UCL/patch/new-search-chips
acholyn Nov 21, 2024
9c83082
stop caching polygons in map source
acholyn Nov 28, 2024
72efa9f
streamlining + refactoring map functions + disabling getBounds in fav…
acholyn Nov 28, 2024
49e661d
simplifying get bounds, using this instead of flyto
acholyn Nov 28, 2024
baeb8a2
cleaning up how we handle results and display them
acholyn Nov 28, 2024
ba85058
disabling logo button
acholyn Nov 29, 2024
748a378
fixing id and code not being generated for each task
acholyn Nov 29, 2024
e7b4d5f
changing success message contents + styling tweaks for task form and …
acholyn Nov 29, 2024
ed5563d
making BM always visible
acholyn Nov 29, 2024
7f22468
updating background + search bar width + task btn
acholyn Nov 29, 2024
cb48587
Merge branch 'main' into 23/minor-changes
acholyn Nov 29, 2024
81aa6e2
disabling login success
acholyn Nov 29, 2024
e3861c3
moving checkbox and making submit cintengent on its being checked
acholyn Nov 29, 2024
b72768b
making transitions smoother
acholyn Nov 29, 2024
40ced12
task btn not uppercase
acholyn Nov 29, 2024
3208964
removing improve map from attribution
acholyn Nov 29, 2024
55adf80
osm contributors
acholyn Nov 29, 2024
6795d49
adding a temp mobile version
acholyn Nov 29, 2024
509118f
tidying + style tweaks
acholyn Nov 29, 2024
7ad8510
tidying + making points and download conditional
acholyn Nov 29, 2024
b583027
putting whatsapp on the contact button
acholyn Nov 29, 2024
5481efc
making some task fetching conditional to user id being present (stops…
acholyn Dec 2, 2024
48d1b00
disabling localstorage pinned preference
acholyn Dec 2, 2024
dceca7f
maintain center and zoom when resizing map
acholyn Dec 2, 2024
f4e26fb
increasing flash time
acholyn Dec 2, 2024
9e6a6a9
fixing scroll flash not working when list not pinned
acholyn Dec 2, 2024
9551039
slugifying download title
acholyn Dec 2, 2024
3ff3581
fixing error when it says details don't match? might be a bug or some…
acholyn Dec 2, 2024
a0da683
logout button conditional
acholyn Dec 2, 2024
31b0dbc
removing disclaimer, adding legal notice
acholyn Dec 2, 2024
c1f9a96
updating colours
acholyn Dec 2, 2024
f6eb543
colours + favicon
acholyn Dec 3, 2024
36af500
updating burger content
acholyn Dec 3, 2024
112b74d
fixing fitting bounds of points
acholyn Dec 3, 2024
284180d
tinkering with the focusing whilst maintaining zoom and center
acholyn Dec 3, 2024
8ec1b48
polygon and point colours
acholyn Dec 4, 2024
238c4db
bm content, legal notice, white logo
acholyn Dec 4, 2024
755be85
Use method chaining rather than settimeout
tcouch Dec 4, 2024
f999dc4
poster-ish
acholyn Dec 4, 2024
8810e64
Merge pull request #28 from UCL/23/map-resize-alt
acholyn Dec 4, 2024
3903678
adding waitlist widget
acholyn Dec 4, 2024
bcf1955
updating chip suggestions
acholyn Dec 4, 2024
5a06735
fixing poster bug
acholyn Dec 4, 2024
f8f4a0a
bm conent and success modal tweaks
acholyn Dec 4, 2024
2b46ed1
renabling actual task flow
acholyn Dec 4, 2024
74bc208
explore others tasks
acholyn Dec 4, 2024
f6f3004
bold kapta
acholyn Dec 4, 2024
3e8471a
fixing jerome typo
acholyn Dec 4, 2024
12a4e76
careers
acholyn Dec 5, 2024
84b9849
updatinng map config
acholyn Dec 5, 2024
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 index.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/favicon.ico" />
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />

<link
href="https://api.mapbox.com/mapbox-gl-js/v3.7.0/mapbox-gl.css"
Expand Down
1 change: 1 addition & 0 deletions public/Logo_green_white.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions public/Poster_cs_1.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed public/favicon.ico
Binary file not shown.
1 change: 1 addition & 0 deletions public/favicon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions public/logo_green_transparent.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions public/logo_white_transparent.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
281 changes: 157 additions & 124 deletions src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ import ConfirmModal from "./utils/ConfirmationModal";
import SuccessModal from "./SuccessModal";
import BurgerMenu from "./BurgerMenu";
import SearchResults from "./SearchResultsList";
import LegalNotice from "./utils/LegalNoticeModal";
import PosterModal from "./utils/PosterModal";
import { KaptaSVGIconWhite } from "./utils/icons";

export default function App() {
const [isTaskFormVisible, setTaskFormVisible] = useState(false);
Expand All @@ -37,12 +40,15 @@ export default function App() {
const [BMopen, setBMopen] = useState(false);

const [boundsVisible, setBoundsVisible] = useState(false);
const [polygonStore, setPolygonStore] = useState(null);
const [focusTask, setFocusTask] = useState(null);
const [chosenTask, setChosenTask] = useState(null);
const [polygonStore, setPolygonStore] = useState(null); // for showing polygons
const [focusTask, setFocusTask] = useState(null); // for showing data points
const [chosenTaskId, setChosenTaskId] = useState(null); // for showing task in list from popup

const [taskListName, setTaskListName] = useState("mine");

const [noticeVisible, setNoticeVisible] = useState(false);
const [posterVisible, setPosterVisible] = useState(false);

const user = useUserStore();

const showTaskForm = (task) => {
Expand All @@ -62,10 +68,10 @@ export default function App() {
setConfirmModalVisible(true);
};
const showLoginSuccessModal = (message) => {
setSuccessModalVisible(true);
setSuccessMsg(message);
setSuccessIsTask(false);
setEmail("");
// setSuccessModalVisible(true);
// setSuccessMsg(message);
// setSuccessIsTask(false);
// setEmail("");
};

const showFilledLoginForm = (email) => {
Expand All @@ -91,10 +97,12 @@ export default function App() {
polygons.push(task);
}
});
console.log("polygons", polygons);
return polygons;
};

const showSearchResults = (results) => {
setBoundsVisible(false);
if (results !== searchResults) {
setPolygonStore(null); // reset polygon store for each new search
setSearchResults(results);
Expand All @@ -109,156 +117,181 @@ export default function App() {
};

const showTaskInList = (id) => {
setChosenTask(id);
console.log("show task in list", id);
setChosenTaskId(id);
setTaskListVisible(true);
};

const scrollFlashTask = (taskRefs) => {
// if (!isTaskListVisible) setTaskListVisible(true);
console.log("scroll flash", taskRefs, chosenTaskId);
// Scroll to the chosen task
taskRefs.current[chosenTask].scrollIntoView({
taskRefs.current[chosenTaskId].scrollIntoView({
behavior: "smooth",
block: "center",
});
// Make it flash
const taskElement = taskRefs.current[chosenTask];
const taskElement = taskRefs.current[chosenTaskId];
taskElement.classList.add("flash");

// Remove the flash class after the animation duration
setTimeout(() => {
taskElement.classList.remove("flash");
setChosenTask(null);
}, 1600);
setChosenTaskId(null);
}, 2600);
};

return (
<main>
{errorMsg && <ErrorModal message={errorMsg} />}
{!isLoginFormVisible && !user.loggedIn && !signUpFormVisible && (
<div className="login-signup__wrapper">
<Button
variant="outlined"
onClick={() => {
setLoginFormVisible(true);
}}
startIcon={<LoginIcon />}
className="btn--login"
>
Login
</Button>
<Button
color="secondary"
variant="outlined"
onClick={() => {
setSignUpFormVisible(true);
}}
className="btn--signup"
>
Sign Up
</Button>
<>
<main>
<div className="kapta-logo--main">
<KaptaSVGIconWhite />
Kapta
</div>
)}
<LoginForm
isVisible={isLoginFormVisible}
setIsVisible={setLoginFormVisible}
setSignUpVisible={setSignUpFormVisible}
setErrorMsg={setErrorMsg}
showConfirmModal={showConfirmModal}
showLoginSuccessModal={showLoginSuccessModal}
prefilledEmail={email}
/>
<SignUpForm
isVisible={signUpFormVisible}
setIsVisible={setSignUpFormVisible}
showConfirmModal={showConfirmModal}
showFilledLoginForm={showFilledLoginForm}
/>
{confirmModalVisible && (
<ConfirmModal
isVisible={confirmModalVisible}
setIsVisible={setConfirmModalVisible}
recipient={cmRecipient}
{errorMsg && <ErrorModal message={errorMsg} />}
{!isLoginFormVisible && !user.loggedIn && !signUpFormVisible && (
<div className="login-signup__wrapper">
<Button
variant="outlined"
onClick={() => {
setLoginFormVisible(true);
}}
startIcon={<LoginIcon />}
className="btn--login"
>
Login
</Button>
<Button
color="secondary"
variant="outlined"
onClick={() => {
setSignUpFormVisible(true);
}}
className="btn--signup"
>
Sign Up
</Button>
</div>
)}
<LoginForm
isVisible={isLoginFormVisible}
setIsVisible={setLoginFormVisible}
setSignUpVisible={setSignUpFormVisible}
setErrorMsg={setErrorMsg}
showConfirmModal={showConfirmModal}
showLoginSuccessModal={showLoginSuccessModal}
prefilledEmail={email}
/>
<SignUpForm
isVisible={signUpFormVisible}
setIsVisible={setSignUpFormVisible}
showConfirmModal={showConfirmModal}
showFilledLoginForm={showFilledLoginForm}
/>
{confirmModalVisible && (
<ConfirmModal
isVisible={confirmModalVisible}
setIsVisible={setConfirmModalVisible}
recipient={cmRecipient}
showLoginSuccessModal={showLoginSuccessModal}
/>
)}
{successModalVisible && !successIsTask && (
<SuccessModal
taskTitle={successMsg}
setSuccessModalVisible={setSuccessModalVisible}
isTask={successIsTask}
/>
)}
{successModalVisible && successIsTask && (
<SuccessModal
taskTitle={successMsg.title}
taskDescription={successMsg.description}
taskID={successMsg.taskID}
campaignCode={successMsg.campaignCode}
setSuccessModalVisible={setSuccessModalVisible}
isTask={true}
/>
)}
<LegalNotice
isVisible={noticeVisible}
setIsVisible={setNoticeVisible}
/>
)}
{successModalVisible && !successIsTask && (
<SuccessModal
taskTitle={successMsg}
setSuccessModalVisible={setSuccessModalVisible}
isTask={successIsTask}
<PosterModal
isVisible={posterVisible}
setIsVisible={setPosterVisible}
/>
)}
{successModalVisible && successIsTask && (
<SuccessModal
taskTitle={successMsg.title}
taskDescription={successMsg.description}
taskID={successMsg.taskID}
campaignCode={successMsg.campaignCode}
setSuccessModalVisible={setSuccessModalVisible}
isTask={true}
<BurgerMenu
isOpen={BMopen}
setIsOpen={setBMopen}
setNoticeVisible={setNoticeVisible}
setPosterVisible={setPosterVisible}
/>
)}
{user.loggedIn && (
<>
<BurgerMenu isOpen={BMopen} setIsOpen={setBMopen} />
<div className="search-response-wrapper">
<div className="response-container">
{/* this is where the bot responses will go */}
</div>

<SearchForm
showSearchResults={showSearchResults}
taskListOpen={isTaskListVisible || searchResultsVisible}
/>
</div>
<div className="task-map-wrapper">
<Map
boundsVisible={boundsVisible}
polygonStore={polygonStore}
taskListOpen={isTaskListVisible || searchResultsVisible}
focusTask={focusTask}
showTaskInList={showTaskInList}
/>
<TaskList
isVisible={isTaskListVisible}
setIsVisible={setTaskListVisible}
user={user}
showTaskForm={showTaskForm}
showNewTaskForm={showNewTaskForm}
showBounds={showBounds}
setFocusTask={setFocusTask}
chosenTask={chosenTask}
scrollFlashTask={scrollFlashTask}
taskListName={taskListName}
setTaskListName={setTaskListName}
/>
{!user.loggedIn && <div className="background shield"></div>}

<SearchResults
isVisible={searchResultsVisible}
setIsVisible={setSearchResultsVisible}
results={searchResults}
setFocusTask={setFocusTask}
chosenTask={chosenTask}
scrollFlashTask={scrollFlashTask}
/>
<div className="search-response-wrapper">
<div className="response-container">
{/* this is where the bot responses will go */}
</div>
<TaskForm
isVisible={isTaskFormVisible}
setIsVisible={setTaskFormVisible}

<SearchForm
showSearchResults={showSearchResults}
taskListOpen={isTaskListVisible || searchResultsVisible}
isBackground={!user.loggedIn}
/>
</div>
<div className="task-map-wrapper">
<Map
boundsVisible={boundsVisible}
polygonStore={polygonStore}
taskListOpen={isTaskListVisible || searchResultsVisible}
focusTask={focusTask}
showTaskInList={showTaskInList}
isBackground={!user.loggedIn}
/>

<TaskList
isVisible={user.loggedIn && isTaskListVisible}
setIsVisible={setTaskListVisible}
user={user}
taskValues={taskValues}
showTaskSuccessModal={showTaskSuccessModal}
showTaskForm={showTaskForm}
showNewTaskForm={showNewTaskForm}
showBounds={showBounds}
setFocusTask={setFocusTask}
chosenTaskId={chosenTaskId}
scrollFlashTask={scrollFlashTask}
taskListName={taskListName}
setTaskListName={setTaskListName}
/>

<SearchResults
isVisible={user.loggedIn && searchResultsVisible}
setIsVisible={setSearchResultsVisible}
results={searchResults}
setFocusTask={setFocusTask}
chosenTaskId={chosenTaskId}
scrollFlashTask={scrollFlashTask}
/>
<Fab
size="medium"
variant="extended"
color="tomato"
color="primary"
onClick={() => setTaskListVisible(true)}
className="btn--view-tasks"
disabled={!user.loggedIn}
>
TASKS
Task WhatsApp Mappers
</Fab>
</>
)}
</main>
</div>
<TaskForm
isVisible={isTaskFormVisible}
setIsVisible={setTaskFormVisible}
user={user}
taskValues={taskValues}
showTaskSuccessModal={showTaskSuccessModal}
/>
</main>
</>
);
}
Loading