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

Merge Develop onto Main #879

Merged
merged 10 commits into from May 9, 2024
7 changes: 7 additions & 0 deletions .github/pull_request_template.md
Expand Up @@ -4,6 +4,13 @@

### Why did you make the changes?

### Did you run tests?
<!---IMPORTANT NOTE ABOUT RUNNING TESTS: ->
- Some tests may require multiple runs before success.
- Some test failures may not be due to your contribution and can be ignored.
- If tests fail without resolution, please let us know here.
- Directions for running tests are in the README.md

<!--- PR CHECKLIST: PLEASE REMOVE BEFORE SUBMITTING —>
Before submitting, check that you have completed the following tasks:
- [ ] Answered the questions above.
Expand Down
37 changes: 28 additions & 9 deletions .github/workflows/build-and-test-prs.yml
@@ -1,17 +1,39 @@
name: Build & test # on both PRs and push to develop/main
name: Build & test # on PRs (including forks) and push to develop/main

on:
pull_request:
branches: [develop]
pull_request_target:
types: [opened, synchronize]
push:
branches: [develop]

jobs:
build-and-test:
name: Build & test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Get user permission of workflow triggering actor, return true or false
- name: Get Workflow Actor Permission
id: checkAccess
# Action used: https://github.com/actions-cool/check-user-permission
uses: actions-cool/check-user-permission@v2
with:
require: write
username: ${{ github.triggering_actor }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Check user permission from previous step, exit if false
- name: Check Workflow Actor Permission
if: steps.checkAccess.outputs.require-result == 'false'
run: |
echo "${{ github.triggering_actor }} does not have permissions to run workflows on this repo."
echo "Current permission level is ${{ steps.checkAccess.outputs.user-permission }}"
echo "Job originally triggered by ${{ github.actor }}"
exit 1
# Checkout PR code
- name: Checkout code
uses: actions/checkout@v4
with:
# This is dangerous without the first access check
ref: ${{ github.event.pull_request.head.sha }}
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
Expand All @@ -26,14 +48,11 @@ jobs:
- name: Use NodeJs
uses: actions/setup-node@v3
with:
node-version: '20.x'

node-version: "20.x"
- name: Install dependencies
run: yarn install --frozen-lockfile --non-interactive

- name: Run linting
run: yarn lint

- name: Build app
run: yarn build
env:
Expand Down
46 changes: 24 additions & 22 deletions CONTRIBUTING.md
@@ -1,20 +1,16 @@
# How to Contribute to Chayn ⭐

First off, thank you so much for taking the time to contribute!
Thank you for taking the time to contribute!

We ❤️ our contributors!
We ❤️ our contributors and strive to give back more than we get. Have feedback on how we can improve? Questions, insight, or other concerns? We invite you to share in our [this anonymous form](https://forms.gle/v2whmf4XX3du4Y3t9).

While Chayn is hybrid between paid staff and volunteers now, we cherish our volunteers for helping to create Chayn and keep us going! We hope to give back more than our contributors give. Please do not hesitate to give us feedback, so we can learn how to make this experience better for you. 😊 You can include feedback in your pull request, GitHub issue, or [this anonymous form](https://forms.gle/17GQpeHc4G1Mgdf3A).

**This guide below assumes you are an open-source contributor and NOT an official Chayn volunteer that has already completed the onboarding process. If you would like to become an official tech volunteer with Chayn, please [visit our Getting Involved Guide](https://www.notion.so/chayn/Get-involved-423c067536f3426a88005de68f0cab19?pvs=4). As an official Chayn volunteer, you will receive professional onboarding onto our platforms and more opportunities to volunteer outside of GitHub contributions!**

Next, let's get started... 🎉
Do you want to make a greater impact with Chayn and receive special access to our organization and volunteer opportunities? Please visit our [visit our Getting Involved Guide](https://www.chayn.co/get-involved) to get started! Don't forget to star this repository ⭐ so we can find more contributors like you!

# Table of Contents
- [New Contributor Guide:](#new-contributor-guide)
- [Prerequisites](#prerequisites)
- [Where Can I Get Help?](#where-can-i-get-help)
- [What kind of contributions does Chayn want?](#what-kind-of-contributions-does-chayn-want)
- [Prerequisites](#prerequisites)
- [Where Can I Get Help?](#where-can-i-get-help)
- [What kind of contributions does Chayn want?](#what-kind-of-contributions-does-chayn-want)
- [Chayn's Spam Policy](#chayns-spam-contribution-policy-)
- [The Contribution Process Guide:](#the-contribution-process-guide)
1. [Read the README and Code of Conduct](#1-read-the-readme-and-code-of-conduct)
2. [Claim an Issue](#2-claim-an-issue)
Expand All @@ -24,13 +20,9 @@ Next, let's get started... 🎉
6. [Push Changes to GitHub](#6-push-changes-to-github)
7. [Make a Pull Request to Chayn](#7--make-a-pull-request-to-chayn)

# New Contributor Guide

**If you are experienced in making open-source contributions, please feel free to skip ahead to the [Contribution Process Guide](#the-contribution-process-guide).**

## Prerequisites
# Prerequisites


If you are new to GitHub and git version control, here are some resources to help you get started:

- [Getting Started with First Time Git Setup](https://git-scm.com/book/en/v2/Getting-Started-First-Time-Git-Setup)
Expand All @@ -46,7 +38,7 @@ Here are prerequisites you should meet before contributing to Chayn's GitHub:

**It is not required that you have experience contributing to open-source projects on GitHub!** Chayn aims to be a safe space for contributors of all skill-levels to build their skills while making an impact in digital public goods. If this is your first contribution, we recommend saving the cheatsheet linked above for future reference, learning how to navigate the GitHub and git version control docs, and in general -- *learn as you go.* The Chayn team is here to help. You got this! 💪

## Where can I get help?
# Where can I get help?
Chayn maintainers and developers are here to help! We aim to give a safe space for contributors of all skill levels to build their skills while making an impact. 🤝

You can ask Chayn team members questions at any point during your contribution in the following places on GitHub:
Expand All @@ -57,18 +49,28 @@ You can ask Chayn team members questions at any point during your contribution i

Chayn team members will respond within 3 business days.

## What kind of contributions does Chayn want?
# What kind of contributions does Chayn want?

Chayn is open to all kinds of contributions, such as:

- no-code (improved documentation and translations)
- additional software tests
- code of any kind (enhancements, new features, maintenance)
- no-code (documenation, translations) *see spam policy below for accepted documentation changes.

# Chayn's Spam Contribution Policy 🚫

**Chayn will reject contributor pull requests if they are defined as spam or not associated with an issue.**
All pull requests need to be associated with an issue. If you open a pull request without claiming an issue, you will be asked to create an issue for your pull request.

Documentation contributions will only be accepted under these circumstances:
- adds additional context to the developer experience, such as environment set-up.
- describes solutions for common error handling.
- fixes a typo.

Just no spamming (such as unwanted, minor documentation and HTML/CSS changes) please! 🚫
Unwanted documentation changes, such as summarizations, white space edits, or minor grammatical edits will be DENIED (unless there is evidence provided that these changes are for accessibility).

# The Contribution Process Guide:
### The Contribution Process Outline:
# The Contribution Process Guide
### Directions for Contributing to Chayn:
1. [Read the README and Code of Conduct](#1-read-the-readme-and-code-of-conduct)
2. [Claim an Issue](#2-claim-an-issue)
3. [Fork the Repo and Create a New Branch](#3-fork-the-repo-and-create-a-new-branch)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -10,7 +10,7 @@ For a more detailed explanation of this project's key concepts and architecture,

## Get Involved

Do you want to make an impact with Chayn and receive special access to our organization and volunteer opportunities? Please visit our [Getting Involved Guide](https://chayn.notion.site/Get-involved-423c067536f3426a88005de68f0cab19) to get started!
Do you want to make an impact with Chayn and receive special access to our organization and volunteer opportunities? Please visit our [Getting Involved Guide](https://www.chayn.co/get-involved) to get started!

Other ways you can support Chayn are [donating](https://www.paypal.me/chaynhq), starring this repository ⭐ (so we can find more contributors like you!), making an open-source contribution, and supporting us on social media!

Expand Down
9 changes: 8 additions & 1 deletion components/course/CourseHeader.tsx
Expand Up @@ -2,6 +2,7 @@ import { Button } from '@mui/material';
import { ISbRichtext } from '@storyblok/react';
import { useTranslations } from 'next-intl';
import { PROGRESS_STATUS } from '../../constants/enums';
import theme from '../../styles/theme';
import Link from '../common/Link';
import Header from '../layout/Header';

Expand All @@ -27,7 +28,13 @@ const CourseHeader = (props: CourseHeaderProps) => {

return (
<Header {...headerProps}>
<Button variant="outlined" href="/courses" size="small" component={Link}>
<Button
variant="outlined"
sx={{ background: theme.palette.background.default }}
href="/courses"
size="small"
component={Link}
>
{t('backToCourses')}
</Button>
</Header>
Expand Down
4 changes: 3 additions & 1 deletion components/forms/ApplyCodeForm.tsx
Expand Up @@ -71,7 +71,9 @@ const ApplyCodeForm = () => {

if (error === PARTNER_ACCESS_CODE_STATUS.ALREADY_IN_USE) {
setFormError(t('form.codeErrors.alreadyInUse'));
} else if (error === PARTNER_ACCESS_CODE_STATUS.CODE_EXPIRED) {
} else if (error === PARTNER_ACCESS_CODE_STATUS.ALREADY_APPLIED) {
setFormError(t('form.codeErrors.alreadyApplied'));
} else if (error === PARTNER_ACCESS_CODE_STATUS.CODE_EXPIRED) {
setFormError(t('form.codeErrors.expired'));
} else if (
error === PARTNER_ACCESS_CODE_STATUS.DOES_NOT_EXIST ||
Expand Down
17 changes: 15 additions & 2 deletions components/storyblok/StoryblokSessionIbaPage.tsx
Expand Up @@ -22,6 +22,7 @@ import {
import { useTypedSelector } from '../../hooks/store';
import illustrationPerson4Peach from '../../public/illustration_person4_peach.svg';
import { columnStyle } from '../../styles/common';
import theme from '../../styles/theme';
import hasAccessToPage from '../../utils/hasAccessToPage';
import logEvent, { getEventUserData } from '../../utils/logEvent';
import { RichTextOptions } from '../../utils/richText';
Expand Down Expand Up @@ -257,13 +258,25 @@ const StoryblokSessionIbaPage = (props: StoryblokSessionIbaPageProps) => {
imageAlt={headerProps.imageAlt}
progressStatus={sessionProgress}
>
<Button variant="outlined" href="/courses" size="small" component={Link}>
<Button
variant="outlined"
href="/courses"
sx={{ background: theme.palette.background.default }}
size="small"
component={Link}
>
Courses
</Button>

<CircleIcon color="error" sx={{ ...dotStyle, marginX: 1 }} />

<Button variant="outlined" href={`/${course.full_slug}`} size="small" component={Link}>
<Button
variant="outlined"
sx={{ background: theme.palette.background.default }}
href={`/${course.full_slug}`}
size="small"
component={Link}
>
{course.name}
</Button>
<Typography sx={sessionSubtitleStyle} variant="body2">
Expand Down
1 change: 1 addition & 0 deletions constants/enums.ts
Expand Up @@ -22,6 +22,7 @@ export enum PARTNER_ACCESS_CODE_STATUS {
INVALID_CODE = 'INVALID_CODE',
DOES_NOT_EXIST = 'DOES_NOT_EXIST',
ALREADY_IN_USE = 'ALREADY_IN_USE',
ALREADY_APPLIED = 'ALREADY_APPLIED',
CODE_EXPIRED = 'CODE_EXPIRED',
}

Expand Down
28 changes: 28 additions & 0 deletions cypress/integration/create-user.es.cy.tsx
@@ -0,0 +1,28 @@
describe('Create User', () => {
let username = `cypresstestemail+${Date.now()}@chayn.co`;
before(() => {
cy.cleanUpTestState();
});

it('User should be able to create user', () => {
// Start from the home page
cy.visitSpanishPage('/');
cy.wait(2000);
cy.get('h1', { timeout: 8000 })
.contains('Acompáñanos en tu viaje de sanación')
.should('exist');
cy.get('a[href="/es/auth/register"]', { timeout: 5000 }).first().click({ force: true });
cy.wait(2000);
cy.get('h2', { timeout: 8000 }).should('contain', 'Crea una cuenta');
cy.get('#name', { timeout: 8000 }).type('Cypress test');
cy.get('#email', { timeout: 8000 }).type(username);
cy.get('#password', { timeout: 8000 }).type('testpassword');
cy.get('button[type="submit"]').contains('Crea una cuenta').click();
cy.wait(3000);
cy.get('h2', { timeout: 8000 }).should('contain', 'Ayúdanos a entender');
});

after(() => {
cy.logout();
});
});
13 changes: 13 additions & 0 deletions cypress/support/commands.js
Expand Up @@ -156,6 +156,19 @@ Cypress.Commands.add('visitGermanPage', (url) => {
});
});

Cypress.Commands.add('visitSpanishPage', (url) => {
cy.visit(url, {
onBeforeLoad(win) {
Object.defineProperty(win.navigator, 'language', { value: 'es-ES' });
Object.defineProperty(win.navigator, 'languages', { value: ['es'] });
Object.defineProperty(win.navigator, 'accept_languages', { value: ['es'] });
},
headers: {
'Accept-Language': 'es',
},
});
});

// CUSTOM COMMANDS THAT NEED FIREBASE ACCESS
const fbConfig = {
apiKey: Cypress.env('NEXT_PUBLIC_FIREBASE_API_KEY'),
Expand Down
1 change: 1 addition & 0 deletions cypress/support/index.d.ts
Expand Up @@ -35,5 +35,6 @@ declare namespace Cypress {
deleteAllCypressUsers(): Chainable<Element>;
cleanUpTestState(): Chainable<Element>;
visitGermanPage(url: string): Chainable<Element>;
visitSpanishPage(url: string): Chainable<Element>;
}
}
3 changes: 2 additions & 1 deletion messages/account/de.json
Expand Up @@ -23,7 +23,8 @@
"internal": "Es ist ein Fehler bei der Validierung Deines Zugangscodes aufgetreten. Versuche es später nochmal und <contactLink>benachrichtige das Bloom-Team</contactLink>, falls dieser Fehler weiterhin auftritt.",
"expired": "Dieser Code ist abgelaufen. Kontaktiere bitte das Team der Partnerorganisation. ",
"invalid": "Dein Zugangscode scheint ungültig zu sein. Überprüfe auf Tippfehler oder setz Dich mit der Partnerorganisation in Verbindung. ",
"alreadyInUse": "Dieser Code ist bereits verwendet worden. Wenn Du glaubst, dass ein Fehler vorliegt, kontaktiere bitte das Team der Partnerorganisation. "
"alreadyInUse": "Dieser Code ist bereits verwendet worden. Wenn Du glaubst, dass ein Fehler vorliegt, kontaktiere bitte das Team der Partnerorganisation. ",
"alreadyApplied": "Dieser Code wurde bereits auf Ihr Konto angewendet."
}
}
},
Expand Down
3 changes: 2 additions & 1 deletion messages/account/en.json
Expand Up @@ -23,7 +23,8 @@
"internal": "There was an error validating your access code. Try again later and <contactLink>message the Bloom team</contactLink> if you're still getting this error.",
"expired": "This code has expired. Get in touch with the partner's team.",
"invalid": "Your access code appears to be invalid. Check for typos or get in touch with the partner.",
"alreadyInUse": "This code has already been used. If you think there's been a mistake, get in touch with the partner's team."
"alreadyInUse": "This code has already been used. If you think there's been a mistake, get in touch with the partner's team.",
"alreadyApplied": "This code has already been applied to your account."
}
}
},
Expand Down
3 changes: 2 additions & 1 deletion messages/account/es.json
Expand Up @@ -23,7 +23,8 @@
"internal": "Hubo un error al validar el código a su cuenta. Vuelve a intentarlo más tarde y <contactLink>envía un mensaje al equipo de Bloom</contactLink> si sigues recibiendo este error.",
"expired": "Éste código ha expirado. Ponerse en contacto con el socio.",
"invalid": "Su código de acceso parece no ser válido. Verifique los errores tipográficos o póngase en contacto con el socio.",
"alreadyInUse": "Este código ya ha sido usado. Si cree que ha habido un error, póngase en contacto con el socio."
"alreadyInUse": "Este código ya ha sido usado. Si cree que ha habido un error, póngase en contacto con el socio.",
"alreadyApplied": "Este código ya se ha aplicado a su cuenta."
}
}
},
Expand Down
3 changes: 2 additions & 1 deletion messages/account/fr.json
Expand Up @@ -23,7 +23,8 @@
"internal": "Une erreur s'est produite lors de la validation de votre code d'accès. Veuillez réessayer plus tard ou <contactLink>contactez l'équipe Bloom</contactLink> si le problème persiste.",
"expired": "Ce code n'est plus valable. Veuillez prendre contact avec le partenaire.",
"invalid": "Votre code d'accès semble être invalide. Vérifiez les erreurs de frappe ou contactez le partenaire.",
"alreadyInUse": "Ce code a déjà été utilisé. Si vous pensez qu'il y a eu une erreur, contactez le partenaire."
"alreadyInUse": "Ce code a déjà été utilisé. Si vous pensez qu'il y a eu une erreur, contactez le partenaire.",
"alreadyApplied": "Ce code a déjà été appliqué à votre compte."
}
}
},
Expand Down
3 changes: 2 additions & 1 deletion messages/account/hi.json
Expand Up @@ -23,7 +23,8 @@
"internal": "Aapke access code ko validate karne mein error aa raha hai. Baad mein dubara prayaas kariye aur <contactLink>Bloom ki team ko meesage kariye</contactLink> agar aapko yeh error dobara aa raha hai.",
"expired": "Yeh code expire ho chuka hai. Partner ki team se sampark karein. ",
"invalid": "Aapka access code invalid hai. Typos ki jaanch karein ya fir partner se sampark karein.",
"alreadyInUse": "Yeh code pehle se he istemaal ho chuka hai. Agar aapko lagta hai ki koi galti hui hai, toh partner ki team se sampark karein. "
"alreadyInUse": "Yeh code pehle se he istemaal ho chuka hai. Agar aapko lagta hai ki koi galti hui hai, toh partner ki team se sampark karein. ",
"alreadyApplied": "Yeh code apke account me phele se hi lag chuka hai."
}
}
},
Expand Down
3 changes: 2 additions & 1 deletion messages/account/pt.json
Expand Up @@ -23,7 +23,8 @@
"internal": "Ocorreu um erro ao validar seu código de acesso. Tente novamente mais tarde e <contactLink>envie uma mensagem para a equipe do Bloom</contactLink> se o problema persistir.",
"expired": "Este código expirou. Entre em contato com a equipe da organização parceira.",
"invalid": "Seu código de acesso parece estar inválido. Verifique se há erros de digitação ou entre em contato com a organização parceira.",
"alreadyInUse": "Este código já foi utilizado. Se você acha que houve um engano, entre em contato com a equipe da organização parceira."
"alreadyInUse": "Este código já foi utilizado. Se você acha que houve um engano, entre em contato com a equipe da organização parceira.",
"alreadyApplied": "Este código já foi aplicado à sua conta."
}
}
},
Expand Down
5 changes: 5 additions & 0 deletions next.config.js
Expand Up @@ -51,6 +51,11 @@ module.exports = withBundleAnalyzer(
destination: '/courses',
permanent: false,
},
{
source: '/about-our-courses',
destination: '/courses',
permanent: false,
},
];
},
async rewrites() {
Expand Down