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

feat/mano 2021 #1626

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
112 changes: 56 additions & 56 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
@@ -1,63 +1,63 @@
name: Playwright Tests
on:
push:
branches: [main]
tags-ignore: [v*]
pull_request:
branches: [main]
jobs:
test:
timeout-minutes: 30
runs-on: ubuntu-latest
# name: Playwright Tests
# on:
# push:
# branches: [main]
# tags-ignore: [v*]
# pull_request:
# branches: [main]
# jobs:
# test:
# timeout-minutes: 30
# runs-on: ubuntu-latest

services:
postgres:
image: postgres
env:
POSTGRES_PASSWORD: postgres
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
# services:
# postgres:
# image: postgres
# env:
# POSTGRES_PASSWORD: postgres
# options: >-
# --health-cmd pg_isready
# --health-interval 10s
# --health-timeout 5s
# --health-retries 5
# ports:
# - 5432:5432

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 16
- name: Install dependencies
run: yarn
- name: Install Playwright Browsers
run: npx playwright install --with-deps
# steps:
# - uses: actions/checkout@v3
# - uses: actions/setup-node@v3
# with:
# node-version: 16
# - name: Install dependencies
# run: yarn
# - name: Install Playwright Browsers
# run: npx playwright install --with-deps

- name: Install dashboard dependencies
run: yarn --cwd ./dashboard
# - name: Install dashboard dependencies
# run: yarn --cwd ./dashboard

- name: Install api dependencies
run: yarn --cwd ./api
# - name: Install api dependencies
# run: yarn --cwd ./api

- name: Init DB
run: yarn test:init-db
env:
PGDATABASE: manotest
PGBASEURL: postgres://postgres:postgres@localhost:5432
# - name: Init DB
# run: yarn test:init-db
# env:
# PGDATABASE: manotest
# PGBASEURL: postgres://postgres:postgres@localhost:5432

- name: Run Playwright tests
run: yarn playwright test
env:
PGBASEURL: postgres://postgres:postgres@localhost:5432
PGHOST: localhost
PGDATABASE: manotest
PGPORT: 5432
PGUSER: postgres
PGPASSWORD: postgres
# - name: Run Playwright tests
# run: yarn playwright test
# env:
# PGBASEURL: postgres://postgres:postgres@localhost:5432
# PGHOST: localhost
# PGDATABASE: manotest
# PGPORT: 5432
# PGUSER: postgres
# PGPASSWORD: postgres

- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
# - uses: actions/upload-artifact@v3
# if: always()
# with:
# name: playwright-report
# path: playwright-report/
# retention-days: 30
41 changes: 15 additions & 26 deletions app/src/Navigators.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { NavigationContainer, useNavigationContainerRef } from '@react-navigatio
import { createStackNavigator } from '@react-navigation/stack';
import { useMMKVNumber } from 'react-native-mmkv';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import { AgendaIcon, PersonIcon, TerritoryIcon } from './icons';
import { AgendaIcon, PersonIcon, StructuresIcon, TerritoryIcon } from './icons';
import { RecoilRoot, useRecoilValue, useResetRecoilState } from 'recoil';
import logEvents from './services/logEvents';
import Login from './scenes/Login/Login';
Expand Down Expand Up @@ -59,12 +59,15 @@ import AsyncStorage from '@react-native-async-storage/async-storage';
import { currentTeamState, organisationState, teamsState, userState } from './recoil/auth';
import { appCurrentCacheKey, clearCache } from './services/dataManagement';
import useResetAllCachedDataRecoilStates from './recoil/reset';
import MenuIcon from './icons/MenuIcon';
import { TODO } from './recoil/actions';
import ActionsList from './scenes/Actions/ActionsList';

const ActionsStack = createStackNavigator();
const ActionsNavigator = () => {
return (
<ActionsStack.Navigator screenOptions={{ headerShown: false }} initialRouteName="ActionsList">
<ActionsStack.Screen name="ActionsList" component={ActionsTabNavigator} />
<ActionsStack.Screen name="ActionsList" component={ActionsList} initialParams={{ status: TODO }} />
<ActionsStack.Screen name="Action" component={Action} />
<ActionsStack.Screen name="NewActionForm" component={NewActionForm} />
<ActionsStack.Screen name="PersonsSearch" component={PersonsSearch} />
Expand Down Expand Up @@ -209,51 +212,37 @@ const TabNavigator = () => {
name="Agenda"
component={ActionsNavigator}
options={{
tabBarIcon: AgendaIcon,
tabBarIcon: ({ size, color }) => <AgendaIcon size={size} color={color} />,
tabBarLabel: 'AGENDA',
tabBarTestID: 'tab-bar-actions',
}}
/>
{!!organisation?.territoriesEnabled && (
<Tab.Screen
lazy
name="Territories"
component={TerritoriesNavigator}
component={PersonsNavigator}
options={{
tabBarIcon: TerritoryIcon,
tabBarLabel: 'TERRITOIRES',
tabBarTestID: 'tab-bar-territories',
tabBarIcon: ({ size, color }) => <PersonIcon size={size} color={color} />,
tabBarLabel: 'USAGERS',
}}
/>
)}
<Tab.Screen
lazy
name="Persons"
component={PersonsNavigator}
name="Structures"
component={StructuresNavigator}
options={{
tabBarIcon: PersonIcon,
tabBarLabel: 'PERSONNES',
tabBarTestID: 'tab-bar-persons',
}}
/>
<Tab.Screen
lazy
name="Notifications"
component={NotificationsNavigator}
options={{
tabBarIcon: BellWithNotifications,
tabBarLabel: 'PRIORITÉS',
tabBarTestID: 'tab-bar-notifications',
tabBarIcon: ({ size, color }) => <StructuresIcon size={size} color={color} />,
tabBarLabel: 'STRUCTURES',
}}
/>
<Tab.Screen
lazy
name="MenuTab"
component={MenuNavigator}
options={{
tabBarIcon: DotsIcon,
tabBarLabel: 'MENU',
tabBarTestID: 'tab-bar-profil',
tabBarIcon: ({ size, color }) => <MenuIcon size={size} color={color} />,
tabBarLabel: 'PROFIL',
}}
/>
</Tab.Navigator>
Expand Down
77 changes: 16 additions & 61 deletions app/src/components/Button.js
Original file line number Diff line number Diff line change
@@ -1,87 +1,42 @@
import React from 'react';
import styled from 'styled-components';
import { TouchableOpacity, ActivityIndicator, TouchableWithoutFeedback, Dimensions } from 'react-native';
import { MyText } from './MyText';
import colors from '../utils/colors';
import Spacer from './Spacer';

const hitSlop = {
top: 20,
left: 20,
right: 20,
bottom: 20,
};

const Button = ({
caption,
onPress,
disabled,
outlined,
borderColor,
backgroundColor = null,
color = colors.app.color,
loading,
fullWidth,
Icon,
noBorder = false,
buttonSize = 40,
testID = '',
}) => {
const Button = ({ caption, onPress, disabled, outlined, borderColor, backgroundColor = 'green', color = 'white', loading, style = {} }) => {
const Root = loading !== undefined ? TouchableWithoutFeedback : TouchableOpacity;
return (
<Root onPress={onPress} disabled={disabled} hitSlop={hitSlop} testID={testID}>
<ButtonContainer
outlined={outlined}
disabled={disabled}
backgroundColor={backgroundColor}
buttonSize={buttonSize}
noBorder={noBorder}
fullWidth={fullWidth}
borderColor={borderColor}>
<Root onPress={onPress} disabled={disabled}>
<ButtonContainer outlined={outlined} disabled={disabled} backgroundColor={backgroundColor} style={style} borderColor={borderColor}>
{loading ? (
<ActivityIndicator size="small" color={color} />
) : (
<>
{!!Icon && <Icon size={25} color={color} />}
{!!Icon && !!caption && <Spacer height={10} />}
{!!caption && (
<Caption
outlined={outlined}
color={color}
// backgroundColor={backgroundColor}
>
{caption}
</Caption>
)}
</>
<Caption outlined={outlined} color={color} backgroundColor={backgroundColor}>
{caption}
</Caption>
)}
</ButtonContainer>
</Root>
);
};

const buttonSize = 40;
const ButtonContainer = styled.View`
/* background-color: ${(props) => (props.outlined ? 'white' : props.backgroundColor)};
border-color: ${(props) => props.borderColor || props.backgroundColor}; */
${(props) => props.backgroundColor && `background-color: ${props.backgroundColor};`}
border: 1px solid rgba(30, 36, 55, 0.1);
border-radius: 16px;
padding-horizontal: 20px;
padding-vertical: ${(props) => props.buttonSize / 2}px;
background-color: ${(props) => (props.outlined ? 'white' : props.backgroundColor)};
border-color: ${(props) => props.borderColor || props.backgroundColor};
border-width: 1px;
height: ${buttonSize}px;
border-radius: ${buttonSize}px;
padding-horizontal: ${buttonSize / 2}px;
align-self: center;
justify-content: center;
align-items: center;
justify-content: center;
min-width: ${Math.min(Dimensions.get('window').width * 0.3, 140)}px;
flex-direction: row;
/* min-width: 140px; */
${(props) => props.disabled && 'opacity: 0.5;'}
${(props) => props.fullWidth && 'width: 100%;'}
${(props) => props.noBorder && 'border-width: 0;'}
`;

const Caption = styled(MyText)`
color: ${(props) => props.color};
const Caption = styled.Text`
font-weight: bold;
color: ${(props) => (props.outlined ? props.backgroundColor : props.color)};
align-items: center;
justify-content: center;
text-align: center;
Expand Down
9 changes: 8 additions & 1 deletion app/src/components/ButtonDelete.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,14 @@ import Button from './Button';
import colors from '../utils/colors';

const ButtonDelete = ({ onPress, caption = 'Supprimer', deleting }) => (
<Button caption={caption} onPress={onPress} color={colors.delete.color} outlined disabled={deleting} loading={deleting} />
<Button
caption={caption}
onPress={onPress}
backgroundColor={colors.delete.backgroundColor}
color={colors.delete.color}
disabled={deleting}
loading={deleting}
/>
);

export default ButtonDelete;
27 changes: 5 additions & 22 deletions app/src/components/ButtonRight.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,21 @@
import React from 'react';
import styled, { css } from 'styled-components';
import styled from 'styled-components';
import { TouchableOpacity } from 'react-native';
import { MyText } from './MyText';

const hitSlop = {
top: 20,
left: 20,
right: 20,
bottom: 20,
};

const ButtonRight = ({ onPress, caption, color = '#888', left = false, disabled = false }) => (
<ButtonContainer leftCss={left} disabled={disabled}>
<TouchableOpacity onPress={onPress} hitSlop={hitSlop}>
const ButtonRight = ({ onPress, caption, color = '#888' }) => (
<ButtonContainer>
<TouchableOpacity onPress={onPress}>
<Icon>
<Next color={color}>{caption}</Next>
</Icon>
</TouchableOpacity>
</ButtonContainer>
);

const leftCss = css`
margin-right: auto;
`;

const rightCss = css`
margin-left: auto;
`;

const ButtonContainer = styled.View`
margin-left: auto;
flex-grow: 0;
flex-shrink: 0;
${(props) => (props.leftCss ? leftCss : rightCss)}
`;

const iconSize = 30;
Expand All @@ -41,7 +24,7 @@ const Icon = styled.View`
width: ${iconSize}px;
`;

const Next = styled(MyText)`
const Next = styled.Text`
align-self: center;
font-size: ${iconSize - 4}px;
line-height: ${iconSize - 1}px;
Expand Down
1 change: 0 additions & 1 deletion app/src/components/ButtonsContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const ButtonsContainer = styled.View`
flex-direction: row;
justify-content: space-evenly;
margin-bottom: 15px;
background-color: #fff;
`;

export default ButtonsContainer;
Loading
Loading