Skip to content

Commit

Permalink
[US-206] Feat/us 206 theme item card (#155)
Browse files Browse the repository at this point in the history
* feat: ✨ Thematically done.

* chore: 🚧 Update title fonts

* chore: 🚧 Update translations

* chore: 🚧 Theme the see all button

* bug: 🚑 Fix home screen

* chore: 🚧 Improve namespacing of components and screens

* feat: ✨ Implement the redesign of the theme items

* chore: 🚧 Remove unused imports

* chore: 🚧 Update translations

* chore: 🚧 Show the image of theme items

* chore: 🚧 Run eslint

* chore: 🚧 Fix E2E tests

* feat: ✨ Show the theme cards on the home screen

* feat: ✨ Add haptic feedback

* chore: 🚧 Optimize theme card on mobile screen

* chore: 🚧 Update translations

* chore: 🚧 Run eslint

* chore: 🚧 Fix ci

* chore: 🚧 Fix E2E tests

* chore: 🚧 Fix E2E tests

* chore: 🚧 Fix E2E tests

* chore: 🚧 Fix ci (2)

* chore: 🚧 Simplify using scrollable views

* chore: 🚧 Fix tests

* chore: 🚧 Simplify checking if an env setting is enabled

---------

Co-authored-by: Yannick Bruintjes <[email protected]>
  • Loading branch information
KoenvanMeijeren and YannickBR authored Dec 8, 2023
1 parent 2193cc2 commit ec759da
Show file tree
Hide file tree
Showing 56 changed files with 679 additions and 289 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ WP_CONTENT_URL="https://www.windesheim.tech"
WP_DATA_URL="https://www.windesheim.ai"
WP_USERNAME=
WP_PASSWORD=
USE_EXPERIMENTAL_COLORS=
1 change: 1 addition & 0 deletions .github/prepare-action/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,5 @@ runs:
echo WP_DATA_URL="https://www.windesheim.ai" >> .env
echo WP_USERNAME=${{ inputs.wp-username }} >> .env
echo WP_PASSWORD=${{ inputs.wp-password }} >> .env
echo USE_EXPERIMENTAL_COLORS="false" >> .env
cat .env
2 changes: 1 addition & 1 deletion App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import ErrorFallback from './src/components/general/error/ErrorBoundary';
import AppLoader from './src/components/loadingscreen/AppLoader';
import SplashScreenOrApp from './src/components/splashscreen/SplashScreenOrApp';
import { store } from './src/lib/redux/Store';
import AppProviders from './src/providers/AppProviders';
import { RouteLinking } from './src/routes/routeLinking';
import AppProviders from './src/screens/AppProviders';

export default function App() {
return (
Expand Down
17 changes: 0 additions & 17 deletions __tests__/components/wtr/Themes.test.tsx

This file was deleted.

4 changes: 2 additions & 2 deletions cypress/e2e/firstTimeUser.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe('First time user tests', () => {

cy.contains('Home');
cy.contains('Handige prompts');
cy.contains('Tech Providers');
cy.contains("Thema's");
});

it('can answer the background questions and progresses through it', () => {
Expand All @@ -33,6 +33,6 @@ describe('First time user tests', () => {
cy.contains('Overslaan').click();
cy.contains('Home');
cy.contains('Handige prompts');
cy.contains('Tech Providers');
cy.contains("Thema's");
});
});
10 changes: 7 additions & 3 deletions cypress/e2e/home.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,13 @@ describe('Home page tests', () => {

cy.contains('Home');
cy.contains('Useful Prompts');
cy.contains('Tech Providers');
//there should be 5 tech providers
cy.get('[data-testid="tech-provider-text"]').should('have.length', 5);
cy.contains('Themes');
cy.contains('See All');

// There should be 3 themes.
cy.get('[data-testid="theme-card"]').should('have.length', 3);

// There should be 3 prompts.
cy.get('[data-testid="prompt-card"]').should('have.length', 3);
});

Expand Down
6 changes: 6 additions & 0 deletions cypress/e2e/settings.cy.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
// Disable uncaught exception handling.
Cypress.on('uncaught:exception', () => {
// Returning false here prevents Cypress from failing the test.
return false;
});

describe('App settings test', () => {
beforeEach(() => {
cy.visit('/');
Expand Down
6 changes: 3 additions & 3 deletions cypress/e2e/wtr.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,12 @@ describe('WTR page tests', () => {
cy.contains('Artificial Intelligence');
cy.contains('Next UI');
cy.contains('Green IT');
cy.contains('Transaction to interaction');
cy.contains('Transaction to Interaction');
cy.contains('Future of Work');
cy.contains('Cloud Everywhere');
cy.contains('Future of programming');
cy.contains('Future of Programming');
cy.contains('Building Trust');
cy.contains('Quantum computing');
cy.contains('Quantum Computing');
});

it('can view the tech provider Apple', () => {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Binary file added src/assets/fonts/Nunito/Nunito-Bold.ttf
Binary file not shown.
Binary file added src/assets/fonts/Nunito/Nunito-Regular.ttf
Binary file not shown.
Binary file added src/assets/fonts/OpenSans/OpenSans-Bold.ttf
Binary file not shown.
Binary file not shown.
Binary file added src/assets/fonts/OpenSans/OpenSans-ExtraBold.ttf
Binary file not shown.
Binary file not shown.
Binary file added src/assets/fonts/OpenSans/OpenSans-Italic.ttf
Binary file not shown.
Binary file added src/assets/fonts/OpenSans/OpenSans-Light.ttf
Binary file not shown.
Binary file not shown.
Binary file added src/assets/fonts/OpenSans/OpenSans-Medium.ttf
Binary file not shown.
Binary file not shown.
Binary file added src/assets/fonts/OpenSans/OpenSans-Regular.ttf
Binary file not shown.
Binary file added src/assets/fonts/OpenSans/OpenSans-SemiBold.ttf
Binary file not shown.
Binary file not shown.
121 changes: 121 additions & 0 deletions src/components/WTR/Card/ThemeItemCard.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
import React from 'react';
import {
Image,
ImageSourcePropType,
StyleSheet,
View,
ViewStyle,
} from 'react-native';

import { shadow, useColorConfig } from '../../../lib/constants/Colors';
import { useFonts } from '../../../lib/constants/Fonts';
import { HapticFeedback, HapticForces } from '../../../lib/haptic/Hooks';
import { useNavigation } from '../../../lib/utility/navigation/useNavigation';
import { Routes } from '../../../routes/routes';
import { ReadMoreButton } from '../../general/buttons/ReadMoreButton';
import { TextTranslated } from '../../general/text/TextTranslated';
import { IntractableView } from '../../general/views/IntractableView';

type Props = {
title: string;
description: string;
themeImage: ImageSourcePropType;
themeSlug: string;
style?: ViewStyle;
};

export function ThemeItemCard({
title,
description,
themeImage,
themeSlug,
style,
}: Props) {
const colors = useColorConfig();
const fonts = useFonts();
const navigation = useNavigation();

const styles = StyleSheet.create({
card: {
backgroundColor: colors.listItemBg,
borderRadius: 10,
padding: 16,
marginBottom: 16,
...shadow,
},
container: {
flexDirection: 'row',
},
title: {
...fonts.h2,
color: colors.titleDefault,
},
contentContainer: {
marginLeft: 16,
flex: 1,
},
description: {
...fonts.description,
flexWrap: 'wrap',
fontSize: 10,
flexShrink: 1,
},
button: {
borderRadius: 8,
padding: 0,
flexDirection: 'row',
alignItems: 'center',
},
image: {
borderRadius: 15,
height: 75,
width: 75,
resizeMode: 'cover',
},
buttonContainer: {
marginLeft: 'auto',
marginTop: 'auto',
padding: 0,
...fonts.smallLink,
},
buttonText: {
color: colors.text,
...fonts.description,
marginRight: 8,
},
});

return (
<IntractableView
style={[styles.card, style]}
testID="theme-card"
onPress={() => {
HapticFeedback(HapticForces.Light);
navigation.navigate(Routes.WindesheimTechRadar, {
page: themeSlug,
});
}}
>
<View style={styles.container}>
<Image source={themeImage} style={styles.image} />
<View style={styles.contentContainer}>
<TextTranslated style={styles.title} text={title} />
<TextTranslated
style={styles.description}
text={description}
/>

<View style={styles.buttonContainer}>
<ReadMoreButton
buttonStyle={styles.button}
buttonTextStyle={styles.buttonText}
navigateToRoute={Routes.WindesheimTechRadar}
navigationParams={{ page: themeSlug }}
testID={`theme-${themeSlug}-button`}
/>
</View>
</View>
</View>
</IntractableView>
);
}
75 changes: 75 additions & 0 deletions src/components/WTR/TechProviderItems.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
import React from 'react';

//@ts-ignore
import AmazonLogo from '../../assets/images/WTR/TechProviders/amazon.svg';
//@ts-ignore
import AppleLogo from '../../assets/images/WTR/TechProviders/apple.svg';
//@ts-ignore
import CiscoLogo from '../../assets/images/WTR/TechProviders/cisco.svg';
//@ts-ignore
import GoogleLogo from '../../assets/images/WTR/TechProviders/google.svg';
//@ts-ignore
import HpLogo from '../../assets/images/WTR/TechProviders/hp.svg';
//@ts-ignore
import IbmLogo from '../../assets/images/WTR/TechProviders/ibm.svg';
//@ts-ignore
import IntelLogo from '../../assets/images/WTR/TechProviders/intel.svg';
//@ts-ignore
import MetaLogo from '../../assets/images/WTR/TechProviders/meta.svg';
//@ts-ignore
import MicrosoftLogo from '../../assets/images/WTR/TechProviders/microsoft.svg';
//@ts-ignore
import OpenAILogo from '../../assets/images/WTR/TechProviders/openai.svg';
//@ts-ignore
import OracleLogo from '../../assets/images/WTR/TechProviders/oracle.svg';
//@ts-ignore
import SalesForceLogo from '../../assets/images/WTR/TechProviders/salesforce.svg';
//@ts-ignore
import SapLogo from '../../assets/images/WTR/TechProviders/sap.svg';

export type TechProvider = {
name: string;
slug: string;
logo: React.FC<{ width: string; height: string; fill: string }>;
};

export enum TechProviderSlug {
Apple = 'apple',
Amazon = 'aws',
Cisco = 'cisco-systems',
Google = 'google',
HP = 'hp',
IBM = 'ibm',
Intel = 'intel',
Meta = 'meta',
Microsoft = 'microsoft',
OpenAI = 'openai',
Oracle = 'oracle',
SalesForce = 'salesforce',
SAP = 'sap',
}

export const techProviderItems: TechProvider[] = [
{ name: 'Apple', slug: TechProviderSlug.Apple, logo: AppleLogo },
{ name: 'Amazon', slug: TechProviderSlug.Amazon, logo: AmazonLogo },
{ name: 'Cisco', slug: TechProviderSlug.Cisco, logo: CiscoLogo },
{ name: 'Google', slug: TechProviderSlug.Google, logo: GoogleLogo },
{ name: 'HP', slug: TechProviderSlug.HP, logo: HpLogo },
{ name: 'IBM', slug: TechProviderSlug.IBM, logo: IbmLogo },
{ name: 'Intel', slug: TechProviderSlug.Intel, logo: IntelLogo },
{ name: 'Meta', slug: TechProviderSlug.Meta, logo: MetaLogo },
{
name: 'Microsoft',
slug: TechProviderSlug.Microsoft,
logo: MicrosoftLogo,
},
{ name: 'OpenAI', slug: TechProviderSlug.OpenAI, logo: OpenAILogo },
{ name: 'Oracle', slug: TechProviderSlug.Oracle, logo: OracleLogo },
{
name: 'SalesForce',
slug: TechProviderSlug.SalesForce,
logo: SalesForceLogo,
},
{ name: 'SAP', slug: TechProviderSlug.SAP, logo: SapLogo },
];
50 changes: 1 addition & 49 deletions src/components/WTR/TechProviders.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
import React, { useEffect, useState } from 'react';
import {
Platform,
Expand All @@ -10,32 +9,7 @@ import {
} from 'react-native';
import FontAwesome5Icon from 'react-native-vector-icons/FontAwesome5';

//@ts-ignore
import Amazon from '../../assets/images/WTR/TechProviders/amazon.svg';
//@ts-ignore
import Apple from '../../assets/images/WTR/TechProviders/apple.svg';
//@ts-ignore
import Cisco from '../../assets/images/WTR/TechProviders/cisco.svg';
//@ts-ignore
import Google from '../../assets/images/WTR/TechProviders/google.svg';
//@ts-ignore
import Hp from '../../assets/images/WTR/TechProviders/hp.svg';
//@ts-ignore
import Ibm from '../../assets/images/WTR/TechProviders/ibm.svg';
//@ts-ignore
import Intel from '../../assets/images/WTR/TechProviders/intel.svg';
//@ts-ignore
import Meta from '../../assets/images/WTR/TechProviders/meta.svg';
//@ts-ignore
import Microsoft from '../../assets/images/WTR/TechProviders/microsoft.svg';
//@ts-ignore
import OpenAI from '../../assets/images/WTR/TechProviders/openai.svg';
//@ts-ignore
import Oracle from '../../assets/images/WTR/TechProviders/oracle.svg';
//@ts-ignore
import SalesForce from '../../assets/images/WTR/TechProviders/salesforce.svg';
//@ts-ignore
import Sap from '../../assets/images/WTR/TechProviders/sap.svg';
import { TechProvider, techProviderItems } from './TechProviderItems';
import {
useColorConfig,
useColorStateConfig,
Expand All @@ -47,27 +21,6 @@ import { Routes } from '../../routes/routes';
import { TextTranslated } from '../general/text/TextTranslated';
import { TitleWithSeeAll } from '../general/text/TitleWithSeeAll';

type TechProvider = {
name: string;
slug: string;
logo: React.FC<{ width: string; height: string; fill: string }>;
};
const techProviderItems: TechProvider[] = [
{ name: 'Apple', slug: 'apple', logo: Apple },
{ name: 'Amazon', slug: 'aws', logo: Amazon },
{ name: 'Cisco', slug: 'cisco-systems', logo: Cisco },
{ name: 'Google', slug: 'google', logo: Google },
{ name: 'HP', slug: 'hp', logo: Hp },
{ name: 'IBM', slug: 'ibm', logo: Ibm },
{ name: 'Intel', slug: 'intel', logo: Intel },
{ name: 'Meta', slug: 'meta', logo: Meta },
{ name: 'Microsoft', slug: 'microsoft', logo: Microsoft },
{ name: 'OpenAI', slug: 'openai', logo: OpenAI },
{ name: 'Oracle', slug: 'oracle', logo: Oracle },
{ name: 'SalesForce', slug: 'salesforce', logo: SalesForce },
{ name: 'SAP', slug: 'sap', logo: Sap },
];

export const TechProviders = ({ limit }: { limit?: number }) => {
const navigation = useNavigation();
const colors = useColorConfig();
Expand Down Expand Up @@ -114,7 +67,6 @@ export const TechProviders = ({ limit }: { limit?: number }) => {

const navigate = (provider: string) => () => {
HapticFeedback(HapticForces.Light);
//@ts-ignore
navigation.navigate(Routes.WindesheimTechRadar, {
page: provider,
});
Expand Down
Loading

0 comments on commit ec759da

Please sign in to comment.