This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"dependencies": { | |
"@emotion/core": "^10.0.10", | |
"@emotion/react": "^11.7.0", | |
"@emotion/styled": "^11.6.0", | |
"@material-ui/core": "^4.12.3", | |
"@material-ui/icons": "^4.9.1", | |
"@material-ui/lab": "^4.0.0-alpha.56", | |
"@material-ui/pickers": "^3.2.10", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <reference types="cypress" /> | |
import me from '../fixtures/me' | |
import allExercises from '../fixtures/allExercises' | |
import exercise from '../fixtures/exercise' | |
import workoutPlan from '../fixtures/workoutPlan' | |
import suggestedMeals from '../fixtures/suggestedMeals' | |
const MOCK_RESPONSES = { | |
Me: me, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <reference types="cypress" /> | |
describe('Excersises List Page', () => { | |
beforeEach(() => { | |
cy.intercept('POST', 'http://localhost:4000/graphql', (req) => { | |
if (req.body.operationName === 'AllExercises') { | |
req.reply({ | |
statusCode: 200, | |
body: { | |
excersises: [ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const GET_ALL_EXERCISES = gql` | |
query AllExercises($input: ExerciseQueryInput) { | |
exercises(input: $input) { | |
id | |
name | |
description | |
muscles_targeted { | |
id | |
name | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// <reference types="cypress" /> | |
describe('Excersises List Page', () => { | |
beforeEach(() => { | |
cy.intercept('GET', 'http://localhost:8080/excersises', { | |
statusCode: 200, | |
body: { | |
excersises: [ | |
{ | |
name: "Pull Up", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { TeamsProvider } from 'context/teamContext'; | |
const App = () => ( | |
<TeamsProvider> | |
<Layout> | |
<AppRouter /> | |
</Layout> | |
</TeamsProvider> | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { useTeamContext } from 'context/teamContext'; | |
const SelectTeam = () => { | |
const { team, setTeam, allTeams } = useTeamContext(); | |
const handleChange = (e) => { | |
setTeam(e.target.value); | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { createContext, useContext, useEffect, useState } from 'react'; | |
import { useQuery } from 'react-query'; | |
const TeamContext = createContext({ | |
isLoading: false, | |
team: undefined, | |
setTeam: undefined, | |
allTeams: [], | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useMutation, useQuery } from 'react-query'; | |
import React from 'react'; | |
import axios from 'axios'; | |
const NotificationsDrawer = () => { | |
const {notifications, markAsRead } = useNotifications() | |
return ( | |
<Drawer> | |
{notifications.map(notifcation => ( | |
<NotificationCard notification={notification} markAsRead={markAsRead} /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const sumOfTwoNumbers = (arr, target) => { | |
// sort the array in asc order so we can use a sliding window technique to find sum | |
arr.sort((a, b) => a - b) | |
// use two pointers to implement a sliding window technique on sorted array | |
// if we never equal the target sum and the pointer cross, there is no suitable pair | |
let leftPointer = 0; | |
let rightPointer = arr.length - 1; | |
const sumLessThanTarget = () => arr[leftPointer] + arr[rightPointer] < target |
NewerOlder