Skip to content

Commit d2b0daf

Browse files
authored
move configuration values out of configService.js​ file #9 (#12)
1 parent 7d206d3 commit d2b0daf

File tree

11 files changed

+1399
-1262
lines changed

11 files changed

+1399
-1262
lines changed

.github/workflows/contoso-traders-provisioning-deployment.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ jobs:
324324
with:
325325
tokenPrefix: "{{"
326326
tokenSuffix: "}}"
327-
files: ./src/ContosoTraders.Ui.Website/src/services/configService.js
327+
files: ./src/ContosoTraders.Ui.Website/.env
328328
env:
329329
CARTS_API_ENDPOINT: ${{ steps.get-cartsApiEndpoint.outputs.cartsApiEndpoint }}
330330
PRODUCTS_API_ENDPOINT: ${{ steps.get-productsApiEndpoint.outputs.productsApiEndpoint }}

src/ContosoTraders.Ui.Website/.env

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
REACT_APP_APIUrl = 'https://{{PRODUCTS_API_ENDPOINT}}/v1'
2+
REACT_APP_APIUrlShoppingCart = 'https://{{CARTS_API_ENDPOINT}}/v1'
3+
REACT_APP_USEB2C = ''
4+
REACT_APP_B2CAUTHORITY = 'https://login.microsoftonline.com/common'
5+
REACT_APP_B2CCLIENTID = '9db8d08a-d9b6-4e4c-8b46-a3898f985735'
6+
REACT_APP_B2CSCOPES = ["User.Read"]

src/ContosoTraders.Ui.Website/.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
# misc
1313
.DS_Store
14-
.env
1514
.env.local
1615
.env.development.local
1716
.env.test.local

src/ContosoTraders.Ui.Website/package-lock.json

Lines changed: 1348 additions & 1250 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/ContosoTraders.Ui.Website/src/App.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { connect } from "react-redux";
44
import { CartService } from "./services";
55
import Meeting from './pages/home/components/videoCall/Meeting';
66

7-
import { Header, Footer, Appbar } from "./shared";
7+
import { Header, Footer, Appbar, HeaderMessage } from "./shared";
88
import {
99
Home,
1010
List,
@@ -23,7 +23,7 @@ import {
2323

2424
import "./i18n";
2525
import "./main.scss";
26-
26+
import warningIcon from './assets/images/original/Contoso_Assets/Icons/information_icon.svg'
2727

2828
class App extends Component {
2929
constructor() {
@@ -89,6 +89,7 @@ class App extends Component {
8989
<div className="App">
9090
<Fragment>
9191
<div className="mainHeader">
92+
<HeaderMessage type="warning" icon={warningIcon} message="This Is A Demo Store For Testing Purposes — No Orders Shall Be Fulfilled."/>
9293
<Appbar quantity={quantity} />
9394
{this.props.history.location.pathname === '/' || this.props.history.location.pathname === '/new-arrivals' ?
9495
<Header quantity={quantity} />
Lines changed: 1 addition & 0 deletions
Loading

src/ContosoTraders.Ui.Website/src/index.css

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,24 @@ body {
198198
background-color: #F8F8F8 !important;
199199
border: 1px solid #EFEFEF !important;
200200
}
201+
/* Header Message */
202+
.headerMessageDiv{
203+
height: 55px;
204+
font-family: 'Poppins';
205+
letter-spacing: 0.42px;
206+
font-weight: 500;
207+
display: flex;
208+
align-items: center;
209+
justify-content: center;
210+
}
211+
.headerMessageDiv.warning{
212+
background-color: #F0A428;
213+
color: #fff;
214+
}
215+
.headerMessageDiv.error{
216+
background-color: #E81D1D;
217+
color: #fff;
218+
}
201219
/* //Appbar */
202220
.appbar{
203221
box-shadow: none !important;

src/ContosoTraders.Ui.Website/src/services/configService.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@ require("dotenv").config();
44
const settingsUrl = "/api/settings";
55

66
// Note: The '{PRODUCTS_API_ENDPOINT}', '{CARTS_API_ENDPOINT}' tokens will be substituted by github workflow.
7-
const APIUrl = 'https://{{PRODUCTS_API_ENDPOINT}}/v1';
8-
const APIUrlShoppingCart = 'https://{{CARTS_API_ENDPOINT}}/v1';
9-
const UseB2C = '';//process.env.REACT_APP_USEB2C;
10-
const B2cAuthority = "https://login.microsoftonline.com/common";//process.env.REACT_APP_B2CAUTHORITY;
11-
const B2cClientId = "9db8d08a-d9b6-4e4c-8b46-a3898f985735";//process.env.REACT_APP_B2CCLIENTID;
12-
const B2cScopes = ["User.Read"];//process.env.REACT_APP_B2CSCOPES;
7+
const APIUrl = process.env.REACT_APP_APIUrl;
8+
const APIUrlShoppingCart = process.env.REACT_APP_APIUrlShoppingCart;
9+
const UseB2C = process.env.REACT_APP_USEB2C;
10+
const B2cAuthority = process.env.REACT_APP_B2CAUTHORITY;
11+
const B2cClientId = process.env.REACT_APP_B2CCLIENTID;
12+
const B2cScopes = process.env.REACT_APP_B2CSCOPES;
1313
const userEmail = localStorage.getItem('state') ? JSON.parse(localStorage.getItem('state')).userName : null;
1414

1515
const _HeadersConfig = (token, devspaces = undefined) => {

src/ContosoTraders.Ui.Website/src/shared/footer/footer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ const Footer = () => {
1515
<Link to="/">
1616
<Logo />
1717
</Link>
18-
<p className='mt-2'>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.</p>
18+
<p className='mt-2'>We are proud to announce the launch of one of our latest innovations: Contoso Traders eCommerce store. Our journey of building India’s biggest unicorn start-up has been full of successes, but also failures and learning from them.</p>
1919
</Grid>
2020
<Grid item xs={2} className='section-2'>
2121
<ul>
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import React from 'react';
2+
3+
function HeaderMessage(props) {
4+
const { type, icon, message } = props
5+
return (
6+
<div className={`headerMessageDiv ${type}`}>
7+
<img className='icon' src={icon} alt=""/>
8+
<p className='message m-0'>{message}</p>
9+
</div>
10+
);
11+
}
12+
13+
export default HeaderMessage;

src/ContosoTraders.Ui.Website/src/shared/index.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import Footer from './footer/footer';
66
import LoadingSpinner from './loadingSpinner/loadingSpinner'
77
import UploadFile from './uploadFile/uploadFile'
88
import Card from './card/card'
9-
9+
import HeaderMessage from './header/headermessage';
1010
export {
1111
Header,
1212
Appbar,
@@ -16,4 +16,5 @@ export {
1616
UploadFile,
1717
Card,
1818
Categories,
19+
HeaderMessage,
1920
};

0 commit comments

Comments
 (0)