Skip to content
This repository was archived by the owner on Jan 16, 2025. It is now read-only.

Commit f4c4b03

Browse files
committed
merge master into fix-runaway-triggers
2 parents b1066ba + 4cb04b8 commit f4c4b03

39 files changed

+1797
-471
lines changed

ui/package.json

Lines changed: 58 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,59 @@
1-
{
2-
"name": "da-marketplace",
3-
"version": "0.1.17",
4-
"private": true,
5-
"dependencies": {
6-
"@daml.js/da-marketplace": "file:../daml.js/da-marketplace-0.1.17",
7-
"@daml/hub-react": "0.1.0",
8-
"@daml/ledger": "1.10.0",
9-
"@daml/react": "1.10.0",
10-
"@daml/types": "1.10.0",
11-
"classnames": "^2.2.6",
12-
"dotenv": "^8.2.0",
13-
"jsonwebtoken": "^8.5.1",
14-
"jwt-simple": "^0.5.6",
15-
"lodash": "^4.17.20",
16-
"react": "^16.12.0",
17-
"react-dom": "^16.12.0",
18-
"react-minimal-pie-chart": "^8.1.0",
19-
"react-router-dom": "^5.2.0",
20-
"semantic-ui-css": "^2.4.1",
21-
"semantic-ui-react": "^0.88.1"
22-
},
23-
"scripts": {
24-
"start": "react-scripts start",
25-
"build": "react-scripts build",
26-
"test": "react-scripts test --testURL='http://localhost:7575'",
27-
"eject": "react-scripts eject",
28-
"lint": "eslint --ext .js,.jsx,.ts,.tsx src/"
29-
},
30-
"eslintConfig": {
31-
"extends": "react-app"
32-
},
33-
"browserslist": {
34-
"production": [
35-
">0.2%",
36-
"not dead",
37-
"not op_mini all"
38-
],
39-
"development": [
40-
"last 1 chrome version",
41-
"last 1 firefox version",
42-
"last 1 safari version"
43-
]
44-
},
45-
"devDependencies": {
46-
"@types/classnames": "^2.2.11",
47-
"@types/dotenv": "^8.2.0",
48-
"@types/jsonwebtoken": "^8.5.0",
49-
"@types/jwt-simple": "^0.5.33",
50-
"@types/lodash": "^4.14.167",
51-
"@types/node": "^14.6.4",
52-
"@types/react": "^16.9.16",
53-
"@types/react-dom": "^16.9.4",
54-
"@types/react-router-dom": "^5.1.5",
55-
"http-proxy-middleware": "^1.0.4",
56-
"react-scripts": "^3.3.0",
57-
"sass": "^1.32.2",
58-
"typescript": "~3.8.3"
59-
}
1+
"name": "da-marketplace",
2+
"version": "0.1.17",
3+
"private": true,
4+
"dependencies": {
5+
"@daml.js/da-marketplace": "file:../daml.js/da-marketplace-0.1.17",
6+
"@daml/hub-react": "0.1.0",
7+
"@daml/ledger": "1.10.0",
8+
"@daml/react": "1.10.0",
9+
"@daml/types": "1.10.0",
10+
"classnames": "^2.2.6",
11+
"dotenv": "^8.2.0",
12+
"jsonwebtoken": "^8.5.1",
13+
"jwt-simple": "^0.5.6",
14+
"lodash": "^4.17.20",
15+
"react": "^16.12.0",
16+
"react-dom": "^16.12.0",
17+
"react-minimal-pie-chart": "^8.1.0",
18+
"react-router-dom": "^5.2.0",
19+
"semantic-ui-css": "^2.4.1",
20+
"semantic-ui-react": "^0.88.1"
21+
},
22+
"scripts": {
23+
"start": "react-scripts start",
24+
"build": "react-scripts build",
25+
"test": "react-scripts test --testURL='http://localhost:7575'",
26+
"eject": "react-scripts eject",
27+
"lint": "eslint --ext .js,.jsx,.ts,.tsx src/"
28+
},
29+
"eslintConfig": {
30+
"extends": "react-app"
31+
},
32+
"browserslist": {
33+
"production": [
34+
">0.2%",
35+
"not dead",
36+
"not op_mini all"
37+
],
38+
"development": [
39+
"last 1 chrome version",
40+
"last 1 firefox version",
41+
"last 1 safari version"
42+
]
43+
},
44+
"devDependencies": {
45+
"@types/classnames": "^2.2.11",
46+
"@types/dotenv": "^8.2.0",
47+
"@types/jsonwebtoken": "^8.5.0",
48+
"@types/jwt-simple": "^0.5.33",
49+
"@types/lodash": "^4.14.167",
50+
"@types/node": "^14.6.4",
51+
"@types/react": "^16.9.16",
52+
"@types/react-dom": "^16.9.4",
53+
"@types/react-router-dom": "^5.1.5",
54+
"http-proxy-middleware": "^1.0.4",
55+
"react-scripts": "^3.3.0",
56+
"sass": "^1.32.2",
57+
"typescript": "~3.8.3"
58+
}
6059
}

ui/src/components/App.scss

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
@import './common/WalletTransaction.scss';
2222
@import './common/WelcomeHeader.scss';
2323
@import './common/MarketRelationships.scss';
24+
@import './common/NotificationCenter.scss';
2425

2526
@import './LoginScreen.scss';
2627
@import './RoleSelectScreen.scss';
@@ -50,6 +51,7 @@
5051
@include loading-screen;
5152
@include market-relationships;
5253
@include notification;
54+
@include notification-center;
5355
@include onboarding-tile;
5456
@include order-card;
5557
@include overflow-menu;
@@ -68,6 +70,7 @@
6870
@include login-screen;
6971
@include role-selector;
7072
@include setup-required;
73+
@include quick-setup;
7174

7275
/* role css */
7376
@include investor;

ui/src/components/App.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import { RegistryLookupProvider } from './common/RegistryLookup'
1919

2020
import LoginScreen from './LoginScreen'
2121
import MainScreen from './MainScreen'
22+
import QuickSetup from './QuickSetup'
2223

2324
/**
2425
* React component for the entry point into the application.
@@ -43,6 +44,10 @@ const App: React.FC = () => {
4344
</QueryStreamProvider>
4445
</WellKnownPartiesProvider>
4546
</Route>
47+
<Route exact path='/quick-setup'>
48+
<QuickSetup onLogin={handleCredentials}/>
49+
</Route>
50+
4651

4752
<Route path='/role' render={() => {
4853
return credentials

ui/src/components/Broker/Broker.tsx

Lines changed: 42 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { useEffect, useState } from 'react'
2-
import { Switch, Route, useRouteMatch } from 'react-router-dom'
2+
import { Switch, Route, useRouteMatch, useHistory } from 'react-router-dom'
33

44
import { useLedger, useParty } from '@daml/react'
55

@@ -21,7 +21,6 @@ import { useContractQuery, usePartyLoading } from '../../websocket/queryStream'
2121

2222
import { useOperator, useDablParties } from '../common/common'
2323
import { wrapDamlTuple } from '../common/damlTypes'
24-
import { useDismissibleNotifications } from '../common/DismissibleNotifications'
2524
import BrokerProfile, { Profile, createField } from '../common/Profile'
2625

2726
import MarketRelationships from '../common/MarketRelationships'
@@ -31,6 +30,7 @@ import RoleSideNav from '../common/RoleSideNav'
3130
import LandingPage from '../common/LandingPage'
3231
import LoadingScreen from '../common/LoadingScreen'
3332
import Wallet from '../common/Wallet'
33+
import NotificationCenter, { useAllNotifications } from '../common/NotificationCenter'
3434

3535
import BrokerOrders from './BrokerOrders'
3636

@@ -49,13 +49,18 @@ const Broker: React.FC<Props> = ({ onLogout }) => {
4949
const invitation = useContractQuery(BrokerInvitation);
5050
const allCustodianRelationships = useContractQuery(CustodianRelationship);
5151
const allDeposits = useContractQuery(AssetDeposit);
52-
const notifications = useDismissibleNotifications();
5352

5453
const [ profile, setProfile ] = useState<Profile>({
5554
'name': createField('', 'Name', 'Your legal name', 'text'),
5655
'location': createField('', 'Location', 'Your current location', 'text')
5756
});
5857

58+
const history = useHistory();
59+
const [allNotifications, setAllNotifications] = useState<object[]>([]);
60+
const [showNotificationAlert, setShowNotificationAlert] = useState(true);
61+
62+
const notifications = useAllNotifications();
63+
5964
useEffect(() => {
6065
if (registeredBroker[0]) {
6166
const rbData = registeredBroker[0].contractData;
@@ -64,9 +69,24 @@ const Broker: React.FC<Props> = ({ onLogout }) => {
6469
location: { ...profile.location, value: rbData.location }
6570
})
6671
}
67-
// eslint-disable-next-line
6872
}, [registeredBroker]);
6973

74+
useEffect(() => {
75+
if (allNotifications.length < notifications.length) {
76+
setAllNotifications(notifications);
77+
setShowNotificationAlert(true);
78+
} else if (allNotifications.length > notifications.length) {
79+
setAllNotifications(notifications);
80+
}
81+
if (notifications.length === 0) setShowNotificationAlert(false);
82+
}, [notifications]);
83+
84+
const handleNotificationAlert = () => {
85+
const currentLocation = history.location.pathname;
86+
history.push({ pathname: `${path}/notifications`, state: currentLocation });
87+
setShowNotificationAlert(false);
88+
}
89+
7090
const updateProfile = async () => {
7191
const key = wrapDamlTuple([operator, broker]);
7292
const args = {
@@ -135,23 +155,37 @@ const Broker: React.FC<Props> = ({ onLogout }) => {
135155
relationshipRequestChoice={BrokerTemplate.Broker_RequestCustodianRelationship}
136156
custodianRelationships={allCustodianRelationships}/>}
137157
sideNav={sideNav}
138-
notifications={notifications}
139-
onLogout={onLogout}/>
158+
onLogout={onLogout}
159+
showNotificationAlert={showNotificationAlert}
160+
handleNotificationAlert={handleNotificationAlert}/>
140161
</Route>
141162

142163
<Route path={`${path}/wallet`}>
143164
<Wallet
144165
role={MarketRole.BrokerRole}
145166
sideNav={sideNav}
146-
onLogout={onLogout}/>
167+
onLogout={onLogout}
168+
showNotificationAlert={showNotificationAlert}
169+
handleNotificationAlert={handleNotificationAlert}/>
147170
</Route>
148171

149172
<Route path={`${path}/orders`}>
150173
<BrokerOrders
151174
sideNav={sideNav}
152175
deposits={allDeposits}
153-
onLogout={onLogout}/>
176+
onLogout={onLogout}
177+
showNotificationAlert={showNotificationAlert}
178+
handleNotificationAlert={handleNotificationAlert}/>
154179
</Route>
180+
181+
<Route path={`${path}/notifications`}>
182+
<NotificationCenter
183+
sideNav={sideNav}
184+
onLogout={onLogout}
185+
showNotificationAlert={showNotificationAlert}
186+
handleNotificationAlert={handleNotificationAlert}/>
187+
</Route>
188+
155189
</Switch>
156190
</div>
157191

ui/src/components/Broker/BrokerOrders.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,12 @@ type Props = {
2424
sideNav: React.ReactElement;
2525
deposits: DepositInfo[];
2626
onLogout: () => void;
27+
showNotificationAlert?: boolean;
28+
handleNotificationAlert?: () => void;
2729
};
2830

2931

30-
const BrokerOrders: React.FC<Props> = ({ sideNav, deposits, onLogout }) => {
32+
const BrokerOrders: React.FC<Props> = ({ sideNav, deposits, onLogout, showNotificationAlert, handleNotificationAlert }) => {
3133
const allExchangeOrders = useContractQuery(Order);
3234
const allBrokerOrderRequests = useContractQuery(BrokerOrderRequest);
3335
const allBrokerOrders = useContractQuery(BrokerOrder);
@@ -40,6 +42,8 @@ const BrokerOrders: React.FC<Props> = ({ sideNav, deposits, onLogout }) => {
4042
sideNav={sideNav}
4143
menuTitle={<><OrdersIcon size='24'/>Orders</>}
4244
onLogout={onLogout}
45+
showNotificationAlert={showNotificationAlert}
46+
handleNotificationAlert={handleNotificationAlert}
4347
>
4448
<PageSection>
4549
<div className='broker-orders'>

0 commit comments

Comments
 (0)