Skip to content

Commit

Permalink
Merge pull request #568 from dataswift/dev
Browse files Browse the repository at this point in the history
CR for Facebook Integration
  • Loading branch information
mudspot committed May 20, 2022
2 parents 4f4dc71 + 39d40b1 commit f2f4e08
Show file tree
Hide file tree
Showing 39 changed files with 2,647 additions and 2,408 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
"private": true,
"dependencies": {
"@dataswift/hat-js": "^0.5.0",
"@dataswift/shared": "0.0.4-cad706a",
"@dataswift/shared": "0.0.5",
"@material-ui/core": "^4.11.4",
"@reduxjs/toolkit": "^1.5.1",
"@testing-library/jest-dom": "^5.12.0",
"@testing-library/react": "^11.2.7",
"date-fns": "^2.22.1",
"hmi": "git+ssh://git@github.com:dataswift/hmi-react.git#v0.4.3",
"hmi": "git+ssh://git@github.com:dataswift/hmi-react.git#v0.5.1",
"js-cookie": "^2.2.1",
"lodash": "^4.17.21",
"lodash-es": "^4.17.21",
Expand All @@ -21,6 +21,7 @@
"react-date-range": "^1.1.4",
"react-dom": "^17.0.2",
"react-dropzone": "^11.3.2",
"react-feather": "^2.0.9",
"react-redux": "^7.2.4",
"react-router": "^5.1.2",
"react-router-dom": "^5.1.2",
Expand Down Expand Up @@ -65,7 +66,6 @@
"@types/markdown-to-jsx": "^7.0.1",
"@types/node": "15.9.0",
"@types/node-sass": "^4.11.0",
"@types/react": "17.0.9",
"@types/react-dom": "17.0.6",
"@types/react-redux": "^7.1.16",
"@types/react-router": "^5.1.14",
Expand Down
54 changes: 25 additions & 29 deletions src/app/Layouts.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { useSelector } from 'react-redux';
import { selectLanguage } from '../features/language/languageSlice';

interface CustomRouteProps extends RouteProps {
children: React.ReactNode;
newAuth?: boolean;
issuedByFooter?: boolean;
footerBackgroundColor?: string;
Expand All @@ -22,20 +23,18 @@ export const PrivateLayoutRoute: React.FC<CustomRouteProps> = ({

return (
<PrivateRoute {...rest}>
<div>
{children}
{issuedByFooter ? (
<IssuedBy
language={language}
wrapperStyles={footerBackgroundColor ? { backgroundColor: footerBackgroundColor } : {}}
/>
) : (
<Footer
language={language}
wrapperStyles={footerBackgroundColor ? { backgroundColor: footerBackgroundColor } : {}}
/>
)}
</div>
{children}
{issuedByFooter ? (
<IssuedBy
language={language}
wrapperStyles={footerBackgroundColor ? { backgroundColor: footerBackgroundColor } : {}}
/>
) : (
<Footer
language={language}
wrapperStyles={footerBackgroundColor ? { backgroundColor: footerBackgroundColor } : {}}
/>
)}
</PrivateRoute>
);
};
Expand All @@ -47,7 +46,6 @@ export const LayoutRoute: React.FC<CustomRouteProps> = ({
...rest
}) => {
const language = useSelector(selectLanguage);

return (
<Route {...rest}>
<div>
Expand Down Expand Up @@ -80,20 +78,18 @@ export const PrivateSpaceRoute: React.FC<CustomRouteProps> = ({
<PrivateRoute {...rest}>
<div>
<PrivateSpace>
<>
{children}
{issuedByFooter ? (
<IssuedBy
language={language}
wrapperStyles={footerBackgroundColor ? { backgroundColor: footerBackgroundColor } : {}}
/>
) : (
<Footer
language={language}
wrapperStyles={footerBackgroundColor ? { backgroundColor: footerBackgroundColor } : {}}
/>
)}
</>
{children}
{issuedByFooter ? (
<IssuedBy
language={language}
wrapperStyles={footerBackgroundColor ? { backgroundColor: footerBackgroundColor } : {}}
/>
) : (
<Footer
language={language}
wrapperStyles={footerBackgroundColor ? { backgroundColor: footerBackgroundColor } : {}}
/>
)}
</PrivateSpace>
</div>
</PrivateRoute>
Expand Down
1 change: 1 addition & 0 deletions src/app/PrivateRoute.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import { HatClientService } from '../services/HatClientService';
import * as queryString from 'query-string';

interface OwnProps extends RouteProps {
children?: React.ReactNode;
newAuth?: boolean;
}

Expand Down
2 changes: 1 addition & 1 deletion src/components/Menus/ActionMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useState, useEffect, useRef } from 'react';
import { useHistory } from 'react-router-dom';
import FormatMessage from '../../features/messages/FormatMessage';

const ActionMenu: React.FC<{ showOptions: boolean }> = ({ showOptions, children }) => {
const ActionMenu: React.FC<{ showOptions: boolean, children: React.ReactNode }> = ({ showOptions, children }) => {
const history = useHistory();
const menuRef = useRef<HTMLObjectElement>(null);
const [showMenu, setShowMenu] = useState(false);
Expand Down
1 change: 1 addition & 0 deletions src/components/Modals/Modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ type Props = {
open: boolean;
onClose: () => void;
titleMessageId: string;
children?: React.ReactNode;
};

const Modal: React.FC<Props> = ({ open, onClose, titleMessageId, children }) => {
Expand Down
1 change: 1 addition & 0 deletions src/components/Modals/RumpelModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import './RumpelModal.scss';
type Props = {
open: boolean;
onClose: () => void;
children?: React.ReactNode;
};

const RumpelModal: React.FC<Props> = ({ open, onClose, children }) => {
Expand Down
1 change: 1 addition & 0 deletions src/components/headers/DetailsHeader/DetailsHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ type DetailsHeaderProps = {
logoAltText: string;
toolbarActions?: React.ReactNode;
backgroundColor?: string;
children: React.ReactNode;
isTool?: boolean;
};

Expand Down
5 changes: 4 additions & 1 deletion src/components/user/ChangePassword/ChangePassword.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Provider } from 'react-redux';
import { configureStore } from '@reduxjs/toolkit';

import messagesSlice from '../../../features/messages/messagesSlice';
import authenticationSlice from '../../../features/authentication/authenticationSlice';
import authenticationSlice, { AuthState } from '../../../features/authentication/authenticationSlice';
import messages from '../../../translations/en.json';
import { ChangePassword } from './ChangePassword';

Expand All @@ -22,6 +22,9 @@ export const store = configureStore({
preloadedState: {
messages,
authentication: {
isAuthenticated: false,
rememberMe: false,
authState: AuthState.LOGIN_REQUEST,
hatName: 'Test',
hatDomain: '.test.com',
},
Expand Down
2 changes: 1 addition & 1 deletion src/components/user/Login/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ const Login: React.FC = () => {
<span className={'flex-spacer-small'} />
<img
className={'login-dataswift-logo'}
src={'https://cdn.dataswift.io/dataswift/logo/ds-full-dark.svg'}
src={'https://cdn.dataswift.io/dataswift/logo/dataswift_R_logomark.svg'}
alt={'Dataswift logo'}
/>
<hr />
Expand Down
3 changes: 3 additions & 0 deletions src/features/applications/ApplicationDetails.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ export const store = configureStore({
preloadedState: {
applications: {
applications: [TEST_HAT_APPLICATION],
applicationHmi: undefined,
applicationHmiState: 'idle',
expirationTime: 20,
},
},
});
Expand Down
2 changes: 1 addition & 1 deletion src/features/applications/ApplicationDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ const HatApplicationDetails: React.FC = () => {
<FormatMessage id="ds.hat.application.details.rated" /> {app.application.info.rating.score}
</div>

<a href="https://resources.dataswift.io/contents/4a9f5153-7d52-4b79-8eb1-e570aa331291" className="app-link">
<a href="https://docs.dataswift.io/deploy/rating-assurance-and-certification" className="app-link">
<FormatMessage id="ds.hat.application.details.learn" />
</a>

Expand Down
3 changes: 3 additions & 0 deletions src/features/applications/ApplicationDetailsActions.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ export const store = configureStore({
preloadedState: {
applications: {
applications: [TEST_HAT_APPLICATION],
applicationHmi: undefined,
applicationHmiState: 'idle',
expirationTime: 20,
},
messages,
},
Expand Down
5 changes: 5 additions & 0 deletions src/features/applications/ApplicationPermissions.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,18 @@ export const store = configureStore({
preloadedState: {
applications: {
applications: [TEST_HAT_APPLICATION],
applicationHmi: undefined,
applicationHmiState: 'idle',
expirationTime: 20,
},
hmi: {
parentApp: null,
dependencyApps: [],
dependencyTools: []
},
tools: {
tools: [],
expirationTime: 20,
}
},
});
Expand Down
5 changes: 2 additions & 3 deletions src/features/applications/ApplicationPermissions.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useHistory, useParams } from 'react-router-dom';

import { getApplicationById, getApplications, selectApplicationById, selectApplications } from './applicationsSlice';
import './HatApplication.scss';
import { HmiV2 } from "hmi";
import { Hmi } from "hmi";
import {
selectDependencyApps,
selectDependencyTools,
Expand Down Expand Up @@ -54,9 +54,8 @@ const HatApplicationPermissions: React.FC = () => {
}

return (
<HmiV2
<Hmi
email={''}
hmiType={''}
parentApp={app.application}
dependencyApps={dependencyApps.map(app => app.application)}
dependencyTools={dependencyTools.map(tool => tool.info.name)}
Expand Down
3 changes: 3 additions & 0 deletions src/features/applications/HatApplications.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ const store = configureStore({
preloadedState: {
applications: {
applications: [TEST_HAT_APPLICATION],
applicationHmi: undefined,
applicationHmiState: 'idle',
expirationTime: 20,
},
},
});
Expand Down
4 changes: 2 additions & 2 deletions src/features/applications/helper.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { HatApplication } from '@dataswift/hat-js/lib/interfaces/hat-application.interface';
import format from 'date-fns/format';

enum HatApplicationStatus {
export enum HatApplicationStatus {
GOTO = 'goto',
RUNNING = 'running',
FETCHING = 'fetching',
Expand Down Expand Up @@ -63,7 +63,7 @@ export const getStatusButtonText = (app: HatApplication): string => {
case HatApplicationStatus.UPDATE:
return 'Update';
default:
return 'Connect';
return app.application.id.includes("facebook") ? 'Connect with Facebook' : 'Connect';
}
};

Expand Down
5 changes: 4 additions & 1 deletion src/features/authentication/AuthChangePassword.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ export const store = configureStore({
preloadedState: {
messages,
applications: {
applications: []
applications: [],
applicationHmi: undefined,
applicationHmiState: 'idle',
expirationTime: 20,
},
language: {
language: 'en'
Expand Down
5 changes: 4 additions & 1 deletion src/features/authentication/AuthRecoverPassword.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ export const store = configureStore({
preloadedState: {
messages,
applications: {
applications: []
applications: [],
applicationHmi: undefined,
applicationHmiState: 'idle',
expirationTime: 20,
},
language: {
language: 'en'
Expand Down
5 changes: 4 additions & 1 deletion src/features/authentication/AuthVerifyEmail.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ export const store = configureStore({
preloadedState: {
messages,
applications: {
applications: []
applications: [],
applicationHmi: undefined,
applicationHmiState: 'idle',
expirationTime: 20,
},
language: {
language: 'en'
Expand Down
3 changes: 3 additions & 0 deletions src/features/dataplugs/DataPlugDetails.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ export const store = configureStore({
preloadedState: {
applications: {
applications: [TEST_DATA_PLUG],
applicationHmi: undefined,
applicationHmiState: 'idle',
expirationTime: 20,
},
},
});
Expand Down
16 changes: 12 additions & 4 deletions src/features/dataplugs/DataPlugDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import '../applications/HatApplication.scss';
import InformationDetails from '../../components/InformationDetails/InformationDetails';
import { getApplicationById, selectApplicationById } from "../applications/applicationsSlice";
import AppDetailsToolbarActions from "../applications/ApplicationDetailsActions";
import { getAppStatus, getStatusButtonText, getStatusIcon } from "../applications/helper";
import { getAppStatus, getStatusButtonText, getStatusIcon, HatApplicationStatus } from "../applications/helper";
import { Facebook } from 'react-feather';

const DataPlugDetails: React.FC = () => {
const dispatch = useDispatch();
Expand Down Expand Up @@ -49,6 +50,8 @@ const DataPlugDetails: React.FC = () => {
];
};

const getApplicationStatus = () => getAppStatus(app);

return (
<>
<DetailsHeader
Expand All @@ -68,12 +71,17 @@ const DataPlugDetails: React.FC = () => {
<FormatMessage id="ds.hat.application.details.rated" /> {app.application.info.rating.score}
</div>

<a href="https://resources.dataswift.io/contents/4a9f5153-7d52-4b79-8eb1-e570aa331291" className="app-link">
<a href="https://docs.dataswift.io/deploy/rating-assurance-and-certification" className="app-link">
<FormatMessage id="ds.hat.application.details.learn" />
</a>

<div onClick={onAppStatusClick} className={`app-details-status ${getAppStatus(app)} link-button`}>
<i className="material-icons details-button-icon">{getStatusIcon(app)}</i>
<div onClick={onAppStatusClick} className={`app-details-status ${getApplicationStatus()} link-button`}>
{appId.includes("facebook") && getApplicationStatus() === HatApplicationStatus.UNTOUCHED &&
<Facebook className="details-button-icon" />
}
{!(appId.includes("facebook") && getApplicationStatus() === HatApplicationStatus.UNTOUCHED) &&
<i className="material-icons details-button-icon">{getStatusIcon(app)}</i>
}
{getStatusButtonText(app)}
</div>
</DetailsHeader>
Expand Down
3 changes: 3 additions & 0 deletions src/features/dataplugs/DataPlugs.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ export const store = configureStore({
preloadedState: {
applications: {
applications: [TEST_DATA_PLUG],
applicationHmi: undefined,
applicationHmiState: 'idle',
expirationTime: 20,
},
},
});
Expand Down
2 changes: 1 addition & 1 deletion src/features/feed/FeedList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ type Props = {
export const FeedList: React.FC<Props> = ({ dayGroupedFeed, loading, lastFeedElementIntersecting }) => {
const observer = useRef<IntersectionObserver>();

const lastFeedElementRef = useCallback(node => {
const lastFeedElementRef = useCallback((node: any) => {
if (loading) return;
if (observer.current) {
observer.current.disconnect();
Expand Down
Loading

0 comments on commit f2f4e08

Please sign in to comment.