From 951a9e1165ca56d807140ec1e7fbd9372eb86835 Mon Sep 17 00:00:00 2001 From: Ishaan Datta Date: Thu, 14 Aug 2025 18:02:30 -0700 Subject: [PATCH 1/4] test for inserting google forms link --- src/components/recruitment/Timeline.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/recruitment/Timeline.tsx b/src/components/recruitment/Timeline.tsx index 297516c..cca0ba3 100644 --- a/src/components/recruitment/Timeline.tsx +++ b/src/components/recruitment/Timeline.tsx @@ -29,8 +29,12 @@ function Timeline() { if (today > end_day || today < start_day) { return (

- We are not taking applications currently. If you are still interested - you can email us at{' '} + Applications for the team are now officially open! Apply using the following {' '} + + Google Forms Link + + Questions? Send us an email at{' '} ubcagrobot@gmail.com From 74999b9098c95d11f071aa55133ba2fcc6a13245 Mon Sep 17 00:00:00 2001 From: Ishaan Datta Date: Thu, 14 Aug 2025 19:03:19 -0700 Subject: [PATCH 2/4] test env --- .envrc | 1 + flake.lock | 61 ++++++++++++++++++++++++++++++++++++++++++++++++++++ flake.nix | 27 +++++++++++++++++++++++ lefthook.yml | 17 +++++++++++++++ 4 files changed, 106 insertions(+) create mode 100644 .envrc create mode 100644 flake.lock create mode 100644 flake.nix create mode 100644 lefthook.yml diff --git a/.envrc b/.envrc new file mode 100644 index 0000000..8392d15 --- /dev/null +++ b/.envrc @@ -0,0 +1 @@ +use flake \ No newline at end of file diff --git a/flake.lock b/flake.lock new file mode 100644 index 0000000..fff8092 --- /dev/null +++ b/flake.lock @@ -0,0 +1,61 @@ +{ + "nodes": { + "flake-utils": { + "inputs": { + "systems": "systems" + }, + "locked": { + "lastModified": 1731533236, + "narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", + "owner": "numtide", + "repo": "flake-utils", + "rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", + "type": "github" + }, + "original": { + "owner": "numtide", + "repo": "flake-utils", + "type": "github" + } + }, + "nixpkgs": { + "locked": { + "lastModified": 1755027561, + "narHash": "sha256-IVft239Bc8p8Dtvf7UAACMG5P3ZV+3/aO28gXpGtMXI=", + "owner": "NixOS", + "repo": "nixpkgs", + "rev": "005433b926e16227259a1843015b5b2b7f7d1fc3", + "type": "github" + }, + "original": { + "owner": "NixOS", + "ref": "nixos-unstable", + "repo": "nixpkgs", + "type": "github" + } + }, + "root": { + "inputs": { + "flake-utils": "flake-utils", + "nixpkgs": "nixpkgs" + } + }, + "systems": { + "locked": { + "lastModified": 1681028828, + "narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=", + "owner": "nix-systems", + "repo": "default", + "rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e", + "type": "github" + }, + "original": { + "owner": "nix-systems", + "repo": "default", + "type": "github" + } + } + }, + "root": "root", + "version": 7 +} diff --git a/flake.nix b/flake.nix new file mode 100644 index 0000000..3a3cbf1 --- /dev/null +++ b/flake.nix @@ -0,0 +1,27 @@ +{ + description = "Agrobot Devshell"; + + inputs = { + nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable"; + flake-utils.url = "github:numtide/flake-utils"; + }; + + outputs = { self, nixpkgs, flake-utils }: + flake-utils.lib.eachDefaultSystem (system: + let + pkgs = import nixpkgs { inherit system; }; + in + { + devShells.default = pkgs.mkShell { + packages = with pkgs; [ + nodejs_20 + pnpm + lefthook + ]; + + shellHook = '' + echo "Dev shell ready: Node.js $(node -v), pnpm $(pnpm -v)" + ''; + }; + }); +} \ No newline at end of file diff --git a/lefthook.yml b/lefthook.yml new file mode 100644 index 0000000..ba85a92 --- /dev/null +++ b/lefthook.yml @@ -0,0 +1,17 @@ +pre-commit: + parallel: true + commands: + lint: + glob: '*.{js,jsx,ts,tsx,vue,json,css,scss,md}' + run: pnpm run lint + stage_fixed: true + + pretty: + glob: '*.{js,jsx,ts,tsx,vue,json,css,scss,md}' + run: pnpm run pretty + stage_fixed: true +# pre-push: +# commands: +# lint-check: +# run: pnpm run lint +# fail_text: "Linting failed. Please fix the issues before pushing." From 463d493e928fbc5bab8b0cca424a903d0bad7521 Mon Sep 17 00:00:00 2001 From: Ishaan Datta Date: Fri, 15 Aug 2025 02:37:09 +0000 Subject: [PATCH 3/4] fixed recruitment pages --- .gitignore | 57 +-- src/components/recruitment/Timeline.tsx | 475 ++++++++++++------------ 2 files changed, 270 insertions(+), 262 deletions(-) diff --git a/.gitignore b/.gitignore index 2b5a008..7e7c46a 100755 --- a/.gitignore +++ b/.gitignore @@ -1,25 +1,32 @@ -# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. - -# dependencies -/node_modules -/.pnp -.pnp.js -Programming/ - -# testing -/coverage - -# production -/build - -# misc -.DS_Store -.env.local -.env.development.local -.env.test.local -.env.production.local - -npm-debug.log* -yarn-debug.log* -yarn-error.log* -.env +# See https://help.github.com/articles/ignoring-files/ for more about ignoring files. + +# dependencies +/node_modules +/.pnp +.pnp.js +Programming/ + +# testing +/coverage + +# production +/build + +# misc +.DS_Store +.env.local +.env.development.local +.env.test.local +.env.production.local + +npm-debug.log* +yarn-debug.log* +yarn-error.log* +.env + +.envrc +.direnv +flake.nix +flake.lock +.devcontainer +.pnpm-store \ No newline at end of file diff --git a/src/components/recruitment/Timeline.tsx b/src/components/recruitment/Timeline.tsx index cca0ba3..09a8d6d 100644 --- a/src/components/recruitment/Timeline.tsx +++ b/src/components/recruitment/Timeline.tsx @@ -1,237 +1,238 @@ -import React, { useState, useEffect } from 'react' -import { IconContext } from 'react-icons' -import { TbTriangleInvertedFilled } from 'react-icons/tb' -import { FaExternalLinkAlt } from 'react-icons/fa' - -function Timeline() { - const [largeScreen, setLargeScreen] = useState(false) - /* - * Screen size detection - */ - useEffect(() => { - function handleResize() { - setLargeScreen(window.innerWidth >= 1024) - } - - handleResize() - - window.addEventListener('resize', handleResize) - return () => { - window.removeEventListener('resize', handleResize) - } - }, []) - - const today = new Date() - const start_day = new Date(2025, 0, 5) - const end_day = new Date(2025, 0, 22) - - console.log(start_day) - if (today > end_day || today < start_day) { - return ( -

- Applications for the team are now officially open! Apply using the following {' '} - - Google Forms Link - - Questions? Send us an email at{' '} - - ubcagrobot@gmail.com - - . -

- ) - } - - const monthNames = [ - 'JAN', - 'FEB', - 'MAR', - 'APR', - 'MAY', - 'JUN', - 'JUL', - 'AUG', - 'SEP', - 'OCT', - 'NOV', - 'DEC', - ] - const monthNamesLong = [ - 'January', - 'February', - 'March', - 'April', - 'May', - 'June', - 'July', - 'August', - 'September', - 'October', - 'November', - 'December', - ] - - /** - * Using the day, returns a string with the 'ordinal indicators' appended - * @param day - The day you want to format - * @returns - The day with the indicators. 1 -> '1st', 2 -> '2nd' - */ - function AddIndicator(day: number) { - if (day === 11) { - return '11th' - } - if (day === 12) { - return '12th' - } - if (day === 13) { - return '13th' - } - - const last_digit = day % 10 - - switch (last_digit) { - case 1: - return `${day}st` - case 2: - return `${day}nd` - case 3: - return `${day}rd` - default: - return `${day}th` - } - } - - /** - * Takes two dates and returns a px offset for the timeline. - * @param {Date} start_day - Beginning of recruitment - * @param {Date} end_day - End of recruitment - * @returns {number} - Clamped to be between 0-100% of the timeline. - */ - function GetDateOffset(start_day: Date, end_day: Date): number { - // Calculate total duration in days - const totalDuration = (end_day - start_day) / (1000 * 60 * 60 * 24) - - // Calculate elapsed time in days - const elapsedTime = (today - start_day) / (1000 * 60 * 60 * 24) - - // Calculate the percentage progress - let progressPercentage = elapsedTime / totalDuration - if (totalDuration === 0) { - progressPercentage = 1 - } - - // Clamp the progress percentage to the range [0, 1] - const clampedProgress = Math.max(0, Math.min(1, progressPercentage)) - - // Offset of left date + (clampedProgress * width between dates) - return 32 + clampedProgress * 936 - } - - function DateToTriOffset(DateOffset: number): number { - return DateOffset + 124 / 2 - 44 / 2 - } - - const day_pixel_offset: number = GetDateOffset(start_day, end_day) - const triOffset = DateToTriOffset(day_pixel_offset) - const days_to_apply = Math.ceil((end_day - today) / (1000 * 3600 * 24)) - - return ( - <> -

- Applications are open until {monthNamesLong[end_day.getMonth()]}{' '} - {AddIndicator(end_day.getDate())}! -

- {largeScreen ? ( - <> -
-
- {/* start date */} -

- Applications -
- Open -

-
-
- {monthNames[start_day.getMonth()]} - {start_day.getDate()} -
-
- {/* end date */} -

- Applications -
- Close -

-
-
- {monthNames[end_day.getMonth()]} - {end_day.getDate()} -
-
- {/* Current date */} - -
- -
-
- {/*}down arrow */} -
-
- {monthNames[today.getMonth()]} - {today.getDate()} -
-
-
- - ) : ( -
-

- {days_to_apply} -

-

- more days to apply -

-
- )} -

- Before you dive in, check out our recruitment package. It contains - essential information about our teams, projects, and what we're looking - for in new members. Once you're ready, fill out the application form and - take the first step towards an inspiring and impactful experience with - UBC Agrobot! -

-
- - Recruitment Package - - - - Application Form - - -
- - ) -} - -export { Timeline } +import React, { useState, useEffect } from 'react' +import { IconContext } from 'react-icons' +import { TbTriangleInvertedFilled } from 'react-icons/tb' +import { FaExternalLinkAlt } from 'react-icons/fa' + +function Timeline() { + const [largeScreen, setLargeScreen] = useState(false) + /* + * Screen size detection + */ + useEffect(() => { + function handleResize() { + setLargeScreen(window.innerWidth >= 1024) + } + + handleResize() + + window.addEventListener('resize', handleResize) + return () => { + window.removeEventListener('resize', handleResize) + } + }, []) + + const today = new Date() + const start_day = new Date(2025, 0, 5) + const end_day = new Date(2025, 0, 22) + + console.log(start_day) + if (today > end_day || today < start_day) { + return ( +

+ Applications for the team are now officially open! Apply using the following {' '} + + Google Forms Link. + + {' '} + Questions? Send us an email at{' '} + + ubcagrobot@gmail.com + + . +

+ ) + } + + const monthNames = [ + 'JAN', + 'FEB', + 'MAR', + 'APR', + 'MAY', + 'JUN', + 'JUL', + 'AUG', + 'SEP', + 'OCT', + 'NOV', + 'DEC', + ] + const monthNamesLong = [ + 'January', + 'February', + 'March', + 'April', + 'May', + 'June', + 'July', + 'August', + 'September', + 'October', + 'November', + 'December', + ] + + /** + * Using the day, returns a string with the 'ordinal indicators' appended + * @param day - The day you want to format + * @returns - The day with the indicators. 1 -> '1st', 2 -> '2nd' + */ + function AddIndicator(day: number) { + if (day === 11) { + return '11th' + } + if (day === 12) { + return '12th' + } + if (day === 13) { + return '13th' + } + + const last_digit = day % 10 + + switch (last_digit) { + case 1: + return `${day}st` + case 2: + return `${day}nd` + case 3: + return `${day}rd` + default: + return `${day}th` + } + } + + /** + * Takes two dates and returns a px offset for the timeline. + * @param {Date} start_day - Beginning of recruitment + * @param {Date} end_day - End of recruitment + * @returns {number} - Clamped to be between 0-100% of the timeline. + */ + function GetDateOffset(start_day: Date, end_day: Date): number { + // Calculate total duration in days + const totalDuration = (end_day - start_day) / (1000 * 60 * 60 * 24) + + // Calculate elapsed time in days + const elapsedTime = (today - start_day) / (1000 * 60 * 60 * 24) + + // Calculate the percentage progress + let progressPercentage = elapsedTime / totalDuration + if (totalDuration === 0) { + progressPercentage = 1 + } + + // Clamp the progress percentage to the range [0, 1] + const clampedProgress = Math.max(0, Math.min(1, progressPercentage)) + + // Offset of left date + (clampedProgress * width between dates) + return 32 + clampedProgress * 936 + } + + function DateToTriOffset(DateOffset: number): number { + return DateOffset + 124 / 2 - 44 / 2 + } + + const day_pixel_offset: number = GetDateOffset(start_day, end_day) + const triOffset = DateToTriOffset(day_pixel_offset) + const days_to_apply = Math.ceil((end_day - today) / (1000 * 3600 * 24)) + + return ( + <> +

+ Applications are open until {monthNamesLong[end_day.getMonth()]}{' '} + {AddIndicator(end_day.getDate())}! +

+ {largeScreen ? ( + <> +
+
+ {/* start date */} +

+ Applications +
+ Open +

+
+
+ {monthNames[start_day.getMonth()]} + {start_day.getDate()} +
+
+ {/* end date */} +

+ Applications +
+ Close +

+
+
+ {monthNames[end_day.getMonth()]} + {end_day.getDate()} +
+
+ {/* Current date */} + +
+ +
+
+ {/*}down arrow */} +
+
+ {monthNames[today.getMonth()]} + {today.getDate()} +
+
+
+ + ) : ( +
+

+ {days_to_apply} +

+

+ more days to apply +

+
+ )} +

+ Before you dive in, check out our recruitment package. It contains + essential information about our teams, projects, and what we're looking + for in new members. Once you're ready, fill out the application form and + take the first step towards an inspiring and impactful experience with + UBC Agrobot! +

+
+ + Recruitment Package + + + + Application Form + + +
+ + ) +} + +export { Timeline } From 2cfd3725c713b17d72dc675be50c727477eb3ff7 Mon Sep 17 00:00:00 2001 From: Ishaan Datta Date: Fri, 15 Aug 2025 02:38:56 +0000 Subject: [PATCH 4/4] linting --- src/components/recruitment/Timeline.tsx | 478 ++++++++++++------------ 1 file changed, 240 insertions(+), 238 deletions(-) diff --git a/src/components/recruitment/Timeline.tsx b/src/components/recruitment/Timeline.tsx index 09a8d6d..3e35cfb 100644 --- a/src/components/recruitment/Timeline.tsx +++ b/src/components/recruitment/Timeline.tsx @@ -1,238 +1,240 @@ -import React, { useState, useEffect } from 'react' -import { IconContext } from 'react-icons' -import { TbTriangleInvertedFilled } from 'react-icons/tb' -import { FaExternalLinkAlt } from 'react-icons/fa' - -function Timeline() { - const [largeScreen, setLargeScreen] = useState(false) - /* - * Screen size detection - */ - useEffect(() => { - function handleResize() { - setLargeScreen(window.innerWidth >= 1024) - } - - handleResize() - - window.addEventListener('resize', handleResize) - return () => { - window.removeEventListener('resize', handleResize) - } - }, []) - - const today = new Date() - const start_day = new Date(2025, 0, 5) - const end_day = new Date(2025, 0, 22) - - console.log(start_day) - if (today > end_day || today < start_day) { - return ( -

- Applications for the team are now officially open! Apply using the following {' '} - - Google Forms Link. - - {' '} - Questions? Send us an email at{' '} - - ubcagrobot@gmail.com - - . -

- ) - } - - const monthNames = [ - 'JAN', - 'FEB', - 'MAR', - 'APR', - 'MAY', - 'JUN', - 'JUL', - 'AUG', - 'SEP', - 'OCT', - 'NOV', - 'DEC', - ] - const monthNamesLong = [ - 'January', - 'February', - 'March', - 'April', - 'May', - 'June', - 'July', - 'August', - 'September', - 'October', - 'November', - 'December', - ] - - /** - * Using the day, returns a string with the 'ordinal indicators' appended - * @param day - The day you want to format - * @returns - The day with the indicators. 1 -> '1st', 2 -> '2nd' - */ - function AddIndicator(day: number) { - if (day === 11) { - return '11th' - } - if (day === 12) { - return '12th' - } - if (day === 13) { - return '13th' - } - - const last_digit = day % 10 - - switch (last_digit) { - case 1: - return `${day}st` - case 2: - return `${day}nd` - case 3: - return `${day}rd` - default: - return `${day}th` - } - } - - /** - * Takes two dates and returns a px offset for the timeline. - * @param {Date} start_day - Beginning of recruitment - * @param {Date} end_day - End of recruitment - * @returns {number} - Clamped to be between 0-100% of the timeline. - */ - function GetDateOffset(start_day: Date, end_day: Date): number { - // Calculate total duration in days - const totalDuration = (end_day - start_day) / (1000 * 60 * 60 * 24) - - // Calculate elapsed time in days - const elapsedTime = (today - start_day) / (1000 * 60 * 60 * 24) - - // Calculate the percentage progress - let progressPercentage = elapsedTime / totalDuration - if (totalDuration === 0) { - progressPercentage = 1 - } - - // Clamp the progress percentage to the range [0, 1] - const clampedProgress = Math.max(0, Math.min(1, progressPercentage)) - - // Offset of left date + (clampedProgress * width between dates) - return 32 + clampedProgress * 936 - } - - function DateToTriOffset(DateOffset: number): number { - return DateOffset + 124 / 2 - 44 / 2 - } - - const day_pixel_offset: number = GetDateOffset(start_day, end_day) - const triOffset = DateToTriOffset(day_pixel_offset) - const days_to_apply = Math.ceil((end_day - today) / (1000 * 3600 * 24)) - - return ( - <> -

- Applications are open until {monthNamesLong[end_day.getMonth()]}{' '} - {AddIndicator(end_day.getDate())}! -

- {largeScreen ? ( - <> -
-
- {/* start date */} -

- Applications -
- Open -

-
-
- {monthNames[start_day.getMonth()]} - {start_day.getDate()} -
-
- {/* end date */} -

- Applications -
- Close -

-
-
- {monthNames[end_day.getMonth()]} - {end_day.getDate()} -
-
- {/* Current date */} - -
- -
-
- {/*}down arrow */} -
-
- {monthNames[today.getMonth()]} - {today.getDate()} -
-
-
- - ) : ( -
-

- {days_to_apply} -

-

- more days to apply -

-
- )} -

- Before you dive in, check out our recruitment package. It contains - essential information about our teams, projects, and what we're looking - for in new members. Once you're ready, fill out the application form and - take the first step towards an inspiring and impactful experience with - UBC Agrobot! -

-
- - Recruitment Package - - - - Application Form - - -
- - ) -} - -export { Timeline } +import React, { useState, useEffect } from 'react' +import { IconContext } from 'react-icons' +import { TbTriangleInvertedFilled } from 'react-icons/tb' +import { FaExternalLinkAlt } from 'react-icons/fa' + +function Timeline() { + const [largeScreen, setLargeScreen] = useState(false) + /* + * Screen size detection + */ + useEffect(() => { + function handleResize() { + setLargeScreen(window.innerWidth >= 1024) + } + + handleResize() + + window.addEventListener('resize', handleResize) + return () => { + window.removeEventListener('resize', handleResize) + } + }, []) + + const today = new Date() + const start_day = new Date(2025, 0, 5) + const end_day = new Date(2025, 0, 22) + + console.log(start_day) + if (today > end_day || today < start_day) { + return ( +

+ Applications for the team are now officially open! Apply using the + following{' '} + + Google Forms Link. + {' '} + Questions? Send us an email at{' '} + + ubcagrobot@gmail.com + + . +

+ ) + } + + const monthNames = [ + 'JAN', + 'FEB', + 'MAR', + 'APR', + 'MAY', + 'JUN', + 'JUL', + 'AUG', + 'SEP', + 'OCT', + 'NOV', + 'DEC', + ] + const monthNamesLong = [ + 'January', + 'February', + 'March', + 'April', + 'May', + 'June', + 'July', + 'August', + 'September', + 'October', + 'November', + 'December', + ] + + /** + * Using the day, returns a string with the 'ordinal indicators' appended + * @param day - The day you want to format + * @returns - The day with the indicators. 1 -> '1st', 2 -> '2nd' + */ + function AddIndicator(day: number) { + if (day === 11) { + return '11th' + } + if (day === 12) { + return '12th' + } + if (day === 13) { + return '13th' + } + + const last_digit = day % 10 + + switch (last_digit) { + case 1: + return `${day}st` + case 2: + return `${day}nd` + case 3: + return `${day}rd` + default: + return `${day}th` + } + } + + /** + * Takes two dates and returns a px offset for the timeline. + * @param {Date} start_day - Beginning of recruitment + * @param {Date} end_day - End of recruitment + * @returns {number} - Clamped to be between 0-100% of the timeline. + */ + function GetDateOffset(start_day: Date, end_day: Date): number { + // Calculate total duration in days + const totalDuration = (end_day - start_day) / (1000 * 60 * 60 * 24) + + // Calculate elapsed time in days + const elapsedTime = (today - start_day) / (1000 * 60 * 60 * 24) + + // Calculate the percentage progress + let progressPercentage = elapsedTime / totalDuration + if (totalDuration === 0) { + progressPercentage = 1 + } + + // Clamp the progress percentage to the range [0, 1] + const clampedProgress = Math.max(0, Math.min(1, progressPercentage)) + + // Offset of left date + (clampedProgress * width between dates) + return 32 + clampedProgress * 936 + } + + function DateToTriOffset(DateOffset: number): number { + return DateOffset + 124 / 2 - 44 / 2 + } + + const day_pixel_offset: number = GetDateOffset(start_day, end_day) + const triOffset = DateToTriOffset(day_pixel_offset) + const days_to_apply = Math.ceil((end_day - today) / (1000 * 3600 * 24)) + + return ( + <> +

+ Applications are open until {monthNamesLong[end_day.getMonth()]}{' '} + {AddIndicator(end_day.getDate())}! +

+ {largeScreen ? ( + <> +
+
+ {/* start date */} +

+ Applications +
+ Open +

+
+
+ {monthNames[start_day.getMonth()]} + {start_day.getDate()} +
+
+ {/* end date */} +

+ Applications +
+ Close +

+
+
+ {monthNames[end_day.getMonth()]} + {end_day.getDate()} +
+
+ {/* Current date */} + +
+ +
+
+ {/*}down arrow */} +
+
+ {monthNames[today.getMonth()]} + {today.getDate()} +
+
+
+ + ) : ( +
+

+ {days_to_apply} +

+

+ more days to apply +

+
+ )} +

+ Before you dive in, check out our recruitment package. It contains + essential information about our teams, projects, and what we're looking + for in new members. Once you're ready, fill out the application form and + take the first step towards an inspiring and impactful experience with + UBC Agrobot! +

+
+ + Recruitment Package + + + + Application Form + + +
+ + ) +} + +export { Timeline }