Skip to content

Commit

Permalink
merge master
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidRobertAnsart committed Jan 21, 2024
2 parents 9bfca8e + 777c449 commit 83aacfb
Show file tree
Hide file tree
Showing 5 changed files with 102 additions and 12 deletions.
67 changes: 67 additions & 0 deletions .github/workflows/terraform-staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Workflow that do provision of the staging infrastructure and deploy the project.
name: Terraform Apply

#on:
# pull_request:
# branches:
# - master2-terraform

on: workflow_dispatch

jobs:
terraform:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_TF_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_TF_SECRET_ACCESS_KEY }}
aws-region: eu-west-3

- name: Set up Terraform
uses: hashicorp/setup-terraform@v1
with:
terraform_version: 1.6.4

- name: Terraform Init
run: terraform init
if: success()

- name: Terraform Plan
run: terraform plan -var-file=../../terraform/terraform.tfvars
if: success()

- name: Terraform Apply
run: terraform apply -var-file=../../terraform/terraform.tfvars -auto-approve
if: success()

- name: Extract Public IP
id: server_public_ip
run: |
echo "::set-output name=server_public_ip::$(terraform output server_public_ip)"
if: success()

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1

- name: Build, tag, and push image to Amazon ECR
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
run: |
docker build -t $ECR_REGISTRY/1village:staging-br-X .
docker push $ECR_REGISTRY/1village:staging-br-X
if: success()

- name: Pull and run the docker image on the server
run: ssh -i $SSH_KEY_PATH $server "ECR_REGISTRY=$ECR_REGISTRY IMAGE=$ECR_REGISTRY/1village:staging-br-X exec sh" < ./deploy.sh
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
server: ${{steps.server_public_ip.outputs.server_public_ip}}
SSH_KEY_PATH: ${{ github.workspace }}/../private.key
if: success()
13 changes: 12 additions & 1 deletion src/components/accueil/RightNavigation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const RightNavigation = ({ activityUser, displayAsUser = false }: { activ
type: [],
userId: activityUser?.id ?? 0,
});
const isPelico = activityUser.type > UserType.TEACHER;
const isPelico = activityUser.type < UserType.TEACHER;
const isMediator = user !== null && user.type <= UserType.MEDIATOR;

const onclick = React.useCallback(() => {
Expand Down Expand Up @@ -129,6 +129,7 @@ export const RightNavigation = ({ activityUser, displayAsUser = false }: { activ
}
return (
<>
{/* MASCOTTE + drapeau à garder */}
<div
className="bg-secondary vertical-bottom-margin with-sub-header-height"
style={{
Expand Down Expand Up @@ -172,6 +173,9 @@ export const RightNavigation = ({ activityUser, displayAsUser = false }: { activ
<Flag country={activityUser.country?.isoCode}></Flag>
</span>
</div>
{/* MASCOTTE + drapeau à garder */}

{/* BOUTON PROF */}
{isMediator && (
<Button
component="a"
Expand All @@ -184,6 +188,9 @@ export const RightNavigation = ({ activityUser, displayAsUser = false }: { activ
Voir la fiche du professeur
</Button>
)}
{/* BOUTON PROF */}

{/* MAP / METEO */}
<div className="bg-secondary vertical-bottom-margin" style={{ borderRadius: '10px', overflow: 'hidden' }}>
<div style={{ height: '14rem' }}>
<Map
Expand Down Expand Up @@ -218,6 +225,9 @@ export const RightNavigation = ({ activityUser, displayAsUser = false }: { activ
)}
</div>
)}
{/* MAP / METEO */}

{/* LAST ACTIVITIES */}
<div
className="bg-secondary vertical-bottom-margin"
style={{ padding: '1rem', borderRadius: '10px', display: 'flex', justifyContent: 'center', flexDirection: 'column' }}
Expand Down Expand Up @@ -259,6 +269,7 @@ export const RightNavigation = ({ activityUser, displayAsUser = false }: { activ
);
})}
</div>
{/* LAST ACTIVITIES */}
</>
);
};
16 changes: 14 additions & 2 deletions src/components/activities/List.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import React, { useState } from 'react';

import { Button } from '@mui/material';
import { Button, Pagination, Stack } from '@mui/material';

import { ActivityCard } from './ActivityCard';
import { isAnthem } from 'src/activity-types/anyActivity';
Expand Down Expand Up @@ -38,11 +38,20 @@ export const Activities = ({ activities, noButtons = false, withLinks = false, o
}, {}),
[users],
);
const [page, setPage] = useState<number>(1);
const handlePage = (_: React.ChangeEvent<unknown>, value: number) => {
setPage(value);
window.scrollTo({ top: 0, behavior: 'smooth' });
};
const activitiesPerPage = 10;
const startIdx = (page - 1) * activitiesPerPage;
const endIdx = startIdx + activitiesPerPage;

return (
<div>
{activities
.filter((activity) => !isAnthem(activity))
.slice(startIdx, endIdx)
.map((activity, index) => {
const card = (
<ActivityCard
Expand Down Expand Up @@ -139,6 +148,9 @@ export const Activities = ({ activities, noButtons = false, withLinks = false, o
}
return card;
})}
<Stack spacing={2} alignItems="center">
<Pagination count={Math.ceil(activities.length / activitiesPerPage)} page={page} onChange={handlePage} variant="outlined" />
</Stack>
</div>
);
};
14 changes: 7 additions & 7 deletions src/pages/creer-un-jeu/mimique/jouer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { useRouter } from 'next/router';
import React, { useState, useCallback, useMemo, useContext, useEffect } from 'react';

import AccessTimeIcon from '@mui/icons-material/AccessTime';
import AppsIcon from '@mui/icons-material/Apps';
// import AppsIcon from '@mui/icons-material/Apps';
import ShuffleIcon from '@mui/icons-material/Shuffle';
import type { SvgIconTypeMap } from '@mui/material';
import { Box, Button, FormControlLabel, Grid, Radio, RadioGroup } from '@mui/material';
Expand Down Expand Up @@ -51,7 +51,7 @@ type AlreadyPlayerModalProps = {
enum RadioBoxValues {
NEW = 'Nouvelle',
RANDOM = 'Aléatoire',
MOSAIC = 'Mosaïque',
// MOSAIC = 'Mosaïque',
}

type RadioNextGameProps = {
Expand All @@ -66,7 +66,7 @@ type RadioNextGameProps = {
const radioListComponentMapper = {
[RadioBoxValues.NEW]: AccessTimeIcon,
[RadioBoxValues.RANDOM]: ShuffleIcon,
[RadioBoxValues.MOSAIC]: AppsIcon,
//[RadioBoxValues.MOSAIC]: AppsIcon,
};

const RadioNextGame: React.FC<RadioNextGameProps> = ({ value, Icon, onChange, checked }) => (
Expand Down Expand Up @@ -164,10 +164,10 @@ const PlayMimic = () => {
[RadioBoxValues.RANDOM]: async () => {
return await getRandomGame(GameType.MIMIC);
},
[RadioBoxValues.MOSAIC]: () => {
console.error('Not implemented yet');
return undefined;
},
// [RadioBoxValues.MOSAIC]: () => {
// console.error('Not implemented yet');
// return undefined;
// },
};

const nextGame = isLastGame ? undefined : await NEXT_GAME_MAPPER[selectedValue]();
Expand Down
4 changes: 2 additions & 2 deletions src/pages/pelico-profil.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ const PelicoProfil = () => {
Bonjour les Pélicopains,
<br />
<br />
Je suis Pélico, un toucan qui adore voyager ! Cette année, nous allons échanger tous ensemble sur 1Village. Avec Cécile, ma grande
amie, nous serons là toute l’année pour vous guider dans ce voyage.
Je suis Pélico, un toucan qui adore voyager ! Cette année, nous allons échanger tous ensemble sur 1Village. Mes amies et moi serons là
toute l’année pour vous guider dans ce voyage.
<br />
<br />
Vous vous demandez certainement pourquoi je m’appelle Pélico… alors que je ne suis pas un pélican ?
Expand Down

0 comments on commit 83aacfb

Please sign in to comment.