Skip to content

Commit

Permalink
Add recent hackathon videos + fix resource pagination
Browse files Browse the repository at this point in the history
  • Loading branch information
daniel-panhead committed Sep 17, 2024
1 parent d4af6ba commit bcb9dc1
Show file tree
Hide file tree
Showing 3 changed files with 151 additions and 27 deletions.
25 changes: 17 additions & 8 deletions components/ResourceContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,9 +103,10 @@ export default function ResourceContainer() {
cmd_f: false,
});
const [yearFilters, setYearFilters] = useState({
2019: false,
2020: false,
2021: false,
2023: false,
2024: false,
});

const filteredResources = RESOURCES.filter((resource) => {
Expand All @@ -120,9 +121,10 @@ export default function ResourceContainer() {
let cmdfFilter = false;
let isEventFilter = false;

let filter2019 = false;
let filter2020 = false;
let filter2021 = false;
let filter2023 = false;
let filter2024 = false;
let isYearFilter = false;

const isTypeFilterChecked =
Expand All @@ -133,7 +135,10 @@ export default function ResourceContainer() {
const isEventFilterChecked =
eventFilters.hackcamp || eventFilters.nwhacks || eventFilters.cmd_f;
const isYearFilterChecked =
yearFilters[2019] || yearFilters[2020] || yearFilters[2021];
yearFilters[2020] ||
yearFilters[2021] ||
yearFilters[2023] ||
yearFilters[2024];

if (typeFilters.videos) {
videosFilter = resource.type === ResourceType.VIDEO;
Expand Down Expand Up @@ -163,10 +168,6 @@ export default function ResourceContainer() {
cmdfFilter = resource.event === ResourceEvent.CMD_F;
}

if (yearFilters[2019]) {
filter2019 = resource.year === ResourceYear[2019];
}

if (yearFilters[2020]) {
filter2020 = resource.year === ResourceYear[2020];
}
Expand All @@ -175,10 +176,18 @@ export default function ResourceContainer() {
filter2021 = resource.year === ResourceYear[2021];
}

if (yearFilters[2023]) {
filter2023 = resource.year === ResourceYear[2023];
}

if (yearFilters[2024]) {
filter2024 = resource.year === ResourceYear[2024];
}

isTypeFilter =
videosFilter || githubFilter || articlesFilter || slidesFilter;
isEventFilter = hackcampFilter || nwhacksFilter || cmdfFilter;
isYearFilter = filter2019 || filter2020 || filter2021;
isYearFilter = filter2020 || filter2021 || filter2023 || filter2024;

if (isTypeFilterChecked && isEventFilterChecked && isYearFilterChecked) {
return isTypeFilter && isEventFilter && isYearFilter;
Expand Down
13 changes: 9 additions & 4 deletions components/ResourcePage.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,12 @@ export default function ResourcePage({ resources, startingPageIndex = 0 }) {

const getCurrPageResources = (resources, currPageIndex) => {
const currPageResources = [];
for (let i = currPageIndex; i < RESOURCES_PER_PAGE && i < resources.length; i++) {
for (
let i = currPageIndex * RESOURCES_PER_PAGE;
i < currPageIndex * RESOURCES_PER_PAGE + RESOURCES_PER_PAGE &&
i < resources.length;
i++
) {
const { name, year, image, type } = resources[i];
if (!name || !year || !image || !type) {
return;
Expand All @@ -69,9 +74,9 @@ export default function ResourcePage({ resources, startingPageIndex = 0 }) {
};
return (
<ResourcePageWrapper>
{currPageResources.length == 0 ?
{currPageResources.length == 0 ? (
<Body>We couldn&apos;t find any resources here :(</Body>
:
) : (
<>
<ResourcePageContainer>
{currPageResources.map((resource, index) => (
Expand All @@ -86,7 +91,7 @@ export default function ResourcePage({ resources, startingPageIndex = 0 }) {
onNextClick={() => handlePageChange(currPageIndex + 1)}
/>
</>
}
)}
</ResourcePageWrapper>
);
}
140 changes: 125 additions & 15 deletions utils/ResourceUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ export const ResourceEvent = {
}

export const ResourceYear = {
2019: '2019',
2020: '2020',
2021: '2021'
}
2021: '2021',
2023: '2023',
2024: '2024',
};

export const resourceCategoryMapper = {
VIDEO: 'videos',
Expand All @@ -35,60 +36,169 @@ export const resourceCategoryMapper = {
HACK_CAMP: 'hackcamp',
NW_HACKS: 'nwhacks',
CMD_F: 'cmd_f',
2019: '2019',
2020: '2020',
2021: '2021'
}
2021: '2021',
2023: '2023',
2024: '2024',
};

export const RESOURCES = [
{
name: 'Intro to React',
event: ResourceEvent.CMD_F,
year: '2024',
image: 'https://img.youtube.com/vi/LrGwPZwpQCE/hqdefault.jpg',
badge: BADGE_ICON,
type: ResourceType.VIDEO,
link: 'https://www.youtube.com/watch?v=LrGwPZwpQCE',
},
{
name: 'Intro to Figma',
event: ResourceEvent.CMD_F,
year: '2024',
image: 'https://img.youtube.com/vi/6fPYuoJXOcQ/hqdefault.jpg',
badge: BADGE_ICON,
type: ResourceType.VIDEO,
link: 'https://www.youtube.com/watch?v=6fPYuoJXOcQ',
},
{
name: 'Intro to Web Development',
event: ResourceEvent.CMD_F,
year: '2024',
image:
'https://i.ytimg.com/vi/A-45xEvFORk/hqdefault.jpg?sqp=-oaymwEcCNACELwBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLABsNDki65QoYgwL6hxSYVZKSLVWg',
badge: BADGE_ICON,
type: ResourceType.VIDEO,
link: 'https://www.youtube.com/watch?v=A-45xEvFORk',
},
{
name: 'Hackathons and Pitching 101',
event: ResourceEvent.CMD_F,
year: '2024',
image: 'https://img.youtube.com/vi/-tDZ70ZrMOE/hqdefault.jpg',
badge: BADGE_ICON,
type: ResourceType.VIDEO,
link: 'https://www.youtube.com/watch?v=-tDZ70ZrMOE',
},
{
name: 'Networking 101',
event: ResourceEvent.CMD_F,
year: '2024',
image:
'https://i.ytimg.com/vi/eqx5Yc8bnTQ/hqdefault.jpg?sqp=-oaymwEcCNACELwBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLBguSNw3GSwKlictE4AR8CQfP3hpA',
badge: BADGE_ICON,
type: ResourceType.VIDEO,
link: 'https://www.youtube.com/watch?v=eqx5Yc8bnTQ',
},
{
name: 'Intro to APIs',
event: ResourceEvent.NW_HACKS,
year: '2024',
image:
'https://i.ytimg.com/vi/cXA87rr61kE/hqdefault.jpg?sqp=-oaymwEcCNACELwBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLBQYY_VgBeHN4t9-GCWF7u3ctJ56A',
badge: BADGE_ICON,
type: ResourceType.VIDEO,
link: 'https://www.youtube.com/watch?v=cXA87rr61kE',
},
{
name: 'Intro to React',
event: ResourceEvent.HACK_CAMP,
year: '2023',
image: 'https://img.youtube.com/vi/Ty_zuH6UWqw/maxresdefault.jpg',
badge: BADGE_ICON,
type: ResourceType.VIDEO,
link: 'https://www.youtube.com/watch?v=Ty_zuH6UWqw',
},
{
name: 'Internships 101',
event: ResourceEvent.HACK_CAMP,
year: '2023',
image: 'https://img.youtube.com/vi/6W958vfdYeI/maxresdefault.jpg',
badge: BADGE_ICON,
type: ResourceType.VIDEO,
link: 'https://www.youtube.com/watch?v=6W958vfdYeI',
},
{
name: 'Intro to Python',
event: ResourceEvent.HACK_CAMP,
year: '2023',
image: 'https://img.youtube.com/vi/8KotW8mLKUo/maxresdefault.jpg',
badge: BADGE_ICON,
type: ResourceType.VIDEO,
link: 'https://www.youtube.com/watch?v=8KotW8mLKUo',
},
{
name: 'Intro to Design in Figma',
event: ResourceEvent.HACK_CAMP,
year: '2023',
image: 'https://img.youtube.com/vi/QRR-vCzyGOM/maxresdefault.jpg',
badge: BADGE_ICON,
type: ResourceType.VIDEO,
link: 'https://www.youtube.com/watch?v=QRR-vCzyGOM',
},
{
name: 'Intro to Version Control',
event: ResourceEvent.HACK_CAMP,
year: '2023',
image: 'https://img.youtube.com/vi/9FxbsxhKUFI/maxresdefault.jpg',
badge: BADGE_ICON,
type: ResourceType.VIDEO,
link: 'https://www.youtube.com/watch?v=9FxbsxhKUFI',
},
{
name: 'Hackathons 101',
event: ResourceEvent.HACK_CAMP,
year: '2023',
image:
'https://i.ytimg.com/vi/P1a_0hAgIcE/hqdefault.jpg?sqp=-oaymwEcCNACELwBSFXyq4qpAw4IARUAAIhCGAFwAcABBg==&rs=AOn4CLBH30K4Nq_lH9g7TncpogvN-It2CQ',
type: ResourceType.VIDEO,
link: 'https://www.youtube.com/watch?v=P1a_0hAgIcE',
},
{
name: 'Web Dev for Dummies',
year: '2020',
image: 'https://img.youtube.com/vi/R7UxJMAVvLU/maxresdefault.jpg',
badge: BADGE_ICON,
type: ResourceType.VIDEO,
link: 'https://www.youtube.com/watch?v=R7UxJMAVvLU'
link: 'https://www.youtube.com/watch?v=R7UxJMAVvLU',
},
{
name: 'Git the Basics Workshop',
event: ResourceEvent.CMD_F,
year: '2021',
image: 'https://img.youtube.com/vi/BjJn4HW_-PI/maxresdefault.jpg',
badge: BADGE_ICON,
type: ResourceType.VIDEO,
link: 'https://www.youtube.com/watch?v=BjJn4HW_-PI'
link: 'https://www.youtube.com/watch?v=BjJn4HW_-PI',
},
{
name: 'Technical Interview Workshop: Beginner Edition',
year: '2020',
image: 'https://img.youtube.com/vi/J7Goi2aF0uw/maxresdefault.jpg',
badge: BADGE_ICON,
type: ResourceType.VIDEO,
link: 'https://www.youtube.com/watch?v=J7Goi2aF0uw'
link: 'https://www.youtube.com/watch?v=J7Goi2aF0uw',
},
{
name: 'Behind cmd-f 2021',
event: ResourceEvent.CMD_F,
year: '2021',
image: 'https://miro.medium.com/max/1400/0*IZ2xCECQfJ4tsYqs',
type: ResourceType.ARTICLES,
link: 'https://medium.com/nwplusubc/behind-cmd-f-2021-32ef6de26638'
link: 'https://medium.com/nwplusubc/behind-cmd-f-2021-32ef6de26638',
},
{
name: 'Behind nwHacks 2021',
event: ResourceEvent.NW_HACKS,
year: '2021',
image: 'https://miro.medium.com/max/1400/1*cQTv2qABzHhzemU2l885kg.png',
type: ResourceType.ARTICLES,
link: 'https://medium.com/nwplusubc/behind-nwhacks-2021-947ede7ef2bd'
link: 'https://medium.com/nwplusubc/behind-nwhacks-2021-947ede7ef2bd',
},
{
name: 'Behind HackCamp 2020: nwPlus’ first virtual hackathon',
event: ResourceEvent.HACK_CAMP,
year: '2020',
image: 'https://miro.medium.com/max/1400/0*f6s7xt91d0xTG-S-',
type: ResourceType.ARTICLES,
link: 'https://medium.com/nwplusubc/behind-hackcamp-2020-nwplus-first-virtual-hackathon-a5b95e50485e'
link: 'https://medium.com/nwplusubc/behind-hackcamp-2020-nwplus-first-virtual-hackathon-a5b95e50485e',
},
];

Expand Down

0 comments on commit bcb9dc1

Please sign in to comment.