├── .tool-versions ├── src ├── react-app-env.d.ts ├── mocks │ ├── browser.ts │ ├── server.ts │ └── handlers.ts ├── models │ ├── Student.ts │ ├── User.ts │ ├── SurveyResponse.ts │ └── StudentSurveyResponse.ts ├── components │ ├── partials │ │ ├── QueryError.tsx │ │ ├── Avatar.tsx │ │ ├── UserItem.tsx │ │ └── SessionItem.tsx │ ├── icons │ │ ├── vector.svg │ │ ├── timer.svg │ │ ├── homeSelected.svg │ │ ├── personSelected.svg │ │ ├── home.svg │ │ ├── person.svg │ │ └── celebrating.svg │ ├── SurveyShow │ │ ├── TextQuestion.tsx │ │ ├── SingleSelectionOption.tsx │ │ ├── SurveyProgressBar.tsx │ │ ├── MultipleSelectionOption.tsx │ │ └── index.tsx │ ├── Landing.tsx │ ├── EditAccountSuccess.tsx │ ├── WelcomeDashboard │ │ ├── StudentSection.tsx │ │ ├── index.tsx │ │ ├── SessionSection.tsx │ │ └── noSessions.svg │ ├── SessionDuration │ │ ├── style.scss │ │ └── index.tsx │ ├── App.tsx │ ├── Account.tsx │ ├── EditAccount.tsx │ ├── Login.tsx │ ├── EditAccountPassword.tsx │ ├── StudentShow.tsx │ └── MainNav.tsx ├── graphql │ ├── queries │ │ ├── GetStudents.ts │ │ ├── GetCurrentUser.ts │ │ ├── GetSurvey.ts │ │ ├── GetStudentSurveyResponses.ts │ │ ├── GetStudent.ts │ │ ├── GetSurveyResponses.ts │ │ ├── GetSurveyResponse.ts │ │ └── __generated__ │ │ │ ├── GetStudents.ts │ │ │ ├── GetCurrentUser.ts │ │ │ ├── GetStudent.ts │ │ │ ├── GetSurvey.ts │ │ │ ├── GetSurveyResponses.ts │ │ │ ├── GetStudentSurveyResponses.ts │ │ │ └── GetSurveyResponse.ts │ └── mutations │ │ ├── SignInMutation.ts │ │ ├── CreateSurveyResponse.ts │ │ ├── CreateSupportTicket.ts │ │ ├── UpsertSurveyQuestionResponse.ts │ │ ├── UpdateUserMutation.ts │ │ └── __generated__ │ │ ├── UpdateUserPassword.ts │ │ ├── UpdateUser.ts │ │ ├── SignIn.ts │ │ ├── CreateSupportTicket.ts │ │ ├── CreateSurveyResponse.ts │ │ ├── CreateSurveyQuestionResponse.ts │ │ └── UpsertSurveyQuestionResponse.ts ├── utils │ ├── test.tsx │ └── getAge.ts ├── index.css ├── reportWebVitals.ts ├── lib │ └── authentication.ts ├── index.tsx ├── __test__ │ └── components │ │ ├── VolunteerProfilePage.test.tsx │ │ ├── StudentSection.test.tsx │ │ ├── EditVolunteerPasswordPage.test.tsx │ │ ├── EditVolunteerPage.test.tsx │ │ └── Landing.test.tsx └── setupTests.ts ├── public ├── robots.txt ├── favicon.ico ├── logo192.png ├── logo512.png ├── manifest.json ├── index.html └── mockServiceWorker.js ├── craco.config.js ├── .gitignore ├── .github ├── workflows │ ├── test.yml │ └── lint.yml ├── PULL_REQUEST_TEMPLATE.md └── ISSUE_TEMPLATE.md ├── tsconfig.json ├── __generated__ └── globalTypes.ts ├── external └── graphql │ └── schema.graphql ├── LICENSE.md ├── .eslintrc.json ├── tailwind.config.js ├── package.json └── README.md /.tool-versions: -------------------------------------------------------------------------------- 1 | nodejs 16.13.0 2 | yarn 1.22.17 3 | -------------------------------------------------------------------------------- /src/react-app-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubyforgood/inkind-volunteer/HEAD/public/favicon.ico -------------------------------------------------------------------------------- /public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubyforgood/inkind-volunteer/HEAD/public/logo192.png -------------------------------------------------------------------------------- /public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/rubyforgood/inkind-volunteer/HEAD/public/logo512.png -------------------------------------------------------------------------------- /src/mocks/browser.ts: -------------------------------------------------------------------------------- 1 | import { setupWorker } from "msw" 2 | import { handlers } from "./handlers" 3 | 4 | export const worker = setupWorker(...handlers) 5 | -------------------------------------------------------------------------------- /src/models/Student.ts: -------------------------------------------------------------------------------- 1 | import { GetStudents_students } from './../graphql/queries/__generated__/GetStudents' 2 | export type Student = GetStudents_students 3 | -------------------------------------------------------------------------------- /src/models/User.ts: -------------------------------------------------------------------------------- 1 | import { GetCurrentUser_currentUser } from 'graphql/queries/__generated__/GetCurrentUser' 2 | export type User = GetCurrentUser_currentUser 3 | -------------------------------------------------------------------------------- /craco.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | style: { 3 | postcss: { 4 | plugins: [require("tailwindcss"), require("autoprefixer")], 5 | }, 6 | }, 7 | } 8 | -------------------------------------------------------------------------------- /src/models/SurveyResponse.ts: -------------------------------------------------------------------------------- 1 | import { GetSurveyResponses_surveyResponses } from './../graphql/queries/__generated__/GetSurveyResponses' 2 | export type SurveyResponse = GetSurveyResponses_surveyResponses 3 | -------------------------------------------------------------------------------- /src/components/partials/QueryError.tsx: -------------------------------------------------------------------------------- 1 | export const QueryError = ({ error }: { error: unknown }): JSX.Element => ( 2 |
3 |     ERROR: {JSON.stringify(error, null, "  ")}
4 |   
5 | ) 6 | -------------------------------------------------------------------------------- /src/mocks/server.ts: -------------------------------------------------------------------------------- 1 | import { setupServer } from "msw/node" 2 | import { handlers } from "./handlers" 3 | 4 | // Setup requests interception using the given handlers. 5 | export const server = setupServer(...handlers) 6 | -------------------------------------------------------------------------------- /src/models/StudentSurveyResponse.ts: -------------------------------------------------------------------------------- 1 | import { GetStudentSurveyResponses_studentSurveyResponses } from './../graphql/queries/__generated__/GetStudentSurveyResponses' 2 | export type StudentSurveyResponse = GetStudentSurveyResponses_studentSurveyResponses 3 | -------------------------------------------------------------------------------- /src/graphql/queries/GetStudents.ts: -------------------------------------------------------------------------------- 1 | import { gql } from '@apollo/client' 2 | 3 | export const GetStudentsQuery = gql` 4 | query GetStudents { 5 | students { 6 | id 7 | dateOfBirth 8 | email 9 | name 10 | initials 11 | createdAt 12 | updatedAt 13 | } 14 | } 15 | ` 16 | -------------------------------------------------------------------------------- /src/graphql/queries/GetCurrentUser.ts: -------------------------------------------------------------------------------- 1 | import { gql } from "@apollo/client" 2 | 3 | export const GetCurrentUser = gql` 4 | query GetCurrentUser { 5 | currentUser { 6 | id 7 | name 8 | firstName 9 | lastName 10 | phoneNumber 11 | email 12 | initials 13 | role 14 | } 15 | } 16 | ` 17 | -------------------------------------------------------------------------------- /src/graphql/mutations/SignInMutation.ts: -------------------------------------------------------------------------------- 1 | import { gql } from "@apollo/client" 2 | 3 | export const SignInMutation = gql` 4 | mutation SignIn($credentials: AuthProviderCredentialsInput!) { 5 | signInUser(credentials: $credentials) { 6 | user { 7 | id 8 | name 9 | email 10 | } 11 | token 12 | } 13 | } 14 | ` 15 | -------------------------------------------------------------------------------- /src/graphql/mutations/CreateSurveyResponse.ts: -------------------------------------------------------------------------------- 1 | import { gql } from "@apollo/client" 2 | 3 | export const CreateSurveyResponse = gql` 4 | mutation CreateSurveyResponse($surveyId: ID!, $studentId: ID!, $userId: ID!) { 5 | createSurveyResponse(surveyId: $surveyId, studentId: $studentId, userId: $userId) { 6 | response { 7 | id 8 | } 9 | } 10 | } 11 | ` 12 | -------------------------------------------------------------------------------- /src/utils/test.tsx: -------------------------------------------------------------------------------- 1 | import { render, RenderResult } from "@testing-library/react" 2 | import { QueryClient, QueryClientProvider } from "react-query" 3 | 4 | const queryClient = new QueryClient() 5 | 6 | export const renderWithQueryProvider = (children: JSX.Element): RenderResult => 7 | render( 8 | {children} 9 | ) 10 | -------------------------------------------------------------------------------- /src/graphql/queries/GetSurvey.ts: -------------------------------------------------------------------------------- 1 | import { gql } from '@apollo/client' 2 | 3 | export const GetSurveyQuery = gql` 4 | query GetSurvey($id: ID!) { 5 | survey(id: $id) { 6 | id 7 | name 8 | questions { 9 | id 10 | prompt 11 | type 12 | options { 13 | id 14 | label 15 | } 16 | } 17 | } 18 | } 19 | ` 20 | -------------------------------------------------------------------------------- /src/utils/getAge.ts: -------------------------------------------------------------------------------- 1 | export const getAge = (date: Date): number => { 2 | const today = new Date() 3 | const birthDate = new Date(date) 4 | const age = today.getFullYear() - birthDate.getFullYear() 5 | const month = today.getMonth() - birthDate.getMonth() 6 | 7 | if (month < 0 || (month === 0 && today.getDate() < birthDate.getDate())) { 8 | return age - 1 9 | } 10 | 11 | return age 12 | } -------------------------------------------------------------------------------- /src/graphql/mutations/CreateSupportTicket.ts: -------------------------------------------------------------------------------- 1 | import { gql } from "@apollo/client" 2 | 3 | export const CreateSupportTicketMutation = gql` 4 | mutation CreateSupportTicket($surveyResponseId: ID!, $description: String) { 5 | createSupportTicket( 6 | surveyResponseId: $surveyResponseId, 7 | description: $description 8 | ) { 9 | supportTicket { 10 | id 11 | } 12 | } 13 | } 14 | ` 15 | -------------------------------------------------------------------------------- /src/graphql/queries/GetStudentSurveyResponses.ts: -------------------------------------------------------------------------------- 1 | import { gql } from '@apollo/client' 2 | 3 | export const GetStudentSurveyResponsesQuery = gql` 4 | query GetStudentSurveyResponses($id: ID!) { 5 | studentSurveyResponses(id: $id) { 6 | id 7 | student { 8 | name 9 | initials 10 | } 11 | meetingDuration { 12 | minutes 13 | startedAt 14 | } 15 | } 16 | } 17 | ` 18 | -------------------------------------------------------------------------------- /src/components/icons/vector.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /src/graphql/queries/GetStudent.ts: -------------------------------------------------------------------------------- 1 | import { gql } from '@apollo/client' 2 | 3 | export const GetStudentQuery = gql` 4 | query GetStudent($id: ID!) { 5 | student(id: $id) { 6 | id 7 | dateOfBirth 8 | email 9 | name 10 | createdAt 11 | updatedAt 12 | guardianName 13 | guardianPhoneNumber 14 | emergencyContactName 15 | emergencyContactPhoneNumber 16 | } 17 | } 18 | ` 19 | -------------------------------------------------------------------------------- /src/index.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; 4 | 5 | .btn { 6 | @apply px-10 py-5 uppercase bg-purple rounded inline-block text-gray-200; 7 | } 8 | .btn.disabled { 9 | @apply opacity-50 cursor-not-allowed pointer-events-none; 10 | } 11 | 12 | .form-field { 13 | @apply px-4 py-3 border-gray-400 border rounded bg-white text-gray-600 w-full; 14 | } 15 | .link { 16 | @apply text-secondary underline; 17 | } 18 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | 25 | .vscode/settings.json 26 | -------------------------------------------------------------------------------- /src/graphql/queries/GetSurveyResponses.ts: -------------------------------------------------------------------------------- 1 | import { gql } from '@apollo/client' 2 | 3 | export const GetSurveyResponsesQuery = gql` 4 | query GetSurveyResponses { 5 | surveyResponses { 6 | id 7 | student { 8 | name 9 | initials 10 | } 11 | volunteer { 12 | id 13 | name 14 | } 15 | meetingDuration { 16 | minutes 17 | startedAt 18 | } 19 | } 20 | } 21 | ` 22 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: jest 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | pull_request: 8 | branches: 9 | - main 10 | 11 | jobs: 12 | test: 13 | runs-on: ubuntu-latest 14 | 15 | steps: 16 | - uses: actions/checkout@v2.3.4 17 | - name: Setup Node 18 | uses: actions/setup-node@v2 19 | with: 20 | node-version: 16.x 21 | cache: 'yarn' 22 | - run: yarn install 23 | - run: yarn test 24 | -------------------------------------------------------------------------------- /.github/workflows/lint.yml: -------------------------------------------------------------------------------- 1 | name: eslint & check-types 2 | 3 | on: 4 | push: 5 | branches: 6 | - main 7 | pull_request: 8 | branches: 9 | - main 10 | 11 | jobs: 12 | lint: 13 | runs-on: ubuntu-latest 14 | 15 | steps: 16 | - uses: actions/checkout@v2.3.4 17 | - name: Setup Node 18 | uses: actions/setup-node@v2 19 | with: 20 | node-version: 16.x 21 | cache: 'yarn' 22 | - run: yarn install 23 | - run: yarn lint 24 | -------------------------------------------------------------------------------- /src/components/icons/timer.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /src/components/partials/Avatar.tsx: -------------------------------------------------------------------------------- 1 | export declare type AvatarPros = { 2 | initials: string; 3 | size?: number; 4 | }; 5 | 6 | export const Avatar = ({ 7 | initials, 8 | size = 10, 9 | }: AvatarPros): JSX.Element => { 10 | const sizeClasses = `w-${size} h-${size}` 11 | 12 | return ( 13 |
14 | {initials} 15 |
16 | ) 17 | } 18 | -------------------------------------------------------------------------------- /src/graphql/queries/GetSurveyResponse.ts: -------------------------------------------------------------------------------- 1 | import { gql } from '@apollo/client' 2 | 3 | export const GetSurveyResponseQuery = gql` 4 | query GetSurveyResponse($id: ID!) { 5 | surveyResponse(id: $id) { 6 | id 7 | survey { 8 | id 9 | name 10 | questions { 11 | id 12 | heading 13 | prompt 14 | description 15 | type 16 | options { 17 | id 18 | label 19 | } 20 | } 21 | } 22 | } 23 | } 24 | ` 25 | -------------------------------------------------------------------------------- /src/graphql/mutations/UpsertSurveyQuestionResponse.ts: -------------------------------------------------------------------------------- 1 | import { gql } from "@apollo/client" 2 | 3 | export const UpsertSurveyQuestionResponseMutation = gql` 4 | mutation UpsertSurveyQuestionResponse($surveyResponseId: ID!, $questionId: ID!, $optionIds: [ID!], $reply: String) { 5 | upsertSurveyQuestionResponse( 6 | surveyResponseId: $surveyResponseId, 7 | questionId: $questionId, 8 | optionIds: $optionIds, 9 | reply: $reply 10 | ) { 11 | questionResponse { 12 | id 13 | } 14 | } 15 | } 16 | ` 17 | -------------------------------------------------------------------------------- /src/components/SurveyShow/TextQuestion.tsx: -------------------------------------------------------------------------------- 1 | interface TextQuestionProps { 2 | onAnswer: (value: string) => void, 3 | } 4 | 5 | export const TextQuestion = ({ onAnswer }: TextQuestionProps): JSX.Element => { 6 | const onChange = (event: React.ChangeEvent) => { 7 | onAnswer(event.target.value) 8 | } 9 | 10 | return ( 11 |
12 |