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

Default Layout change, fix autodetect #211

Merged
merged 3 commits into from
Apr 10, 2024
Merged
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
10 changes: 5 additions & 5 deletions src/AnalyticsNext/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const ConsentComponentCustom = dynamic(() => import('../Components/ConsentCustom
interface AnalyticsNext {
router: NextRouter;
attributes: any;
customLayout?: boolean;
oldLayout?: boolean;
loginApp?: any;
isLoggedApp?: boolean;
children?: ReactNode;
Expand All @@ -20,7 +20,7 @@ interface AnalyticsNext {
const AnalyticsNext = ({
router,
attributes,
customLayout = false,
oldLayout = false,
loginApp,
isLoggedApp,
children,
Expand All @@ -32,16 +32,16 @@ const AnalyticsNext = ({
{children}
{process.env.NEXT_PUBLIC_DISABLE_ANALYTICS_CONSENT !== 'true' && (
<>
{customLayout ? (
<ConsentComponentCustom
{oldLayout ? (
<ConsentComponent
endpoint={process.env.NEXT_PUBLIC_ENDPOINT_ANALYTICS_URL}
networkEnv={process.env.NEXT_PUBLIC_CONCORDIUM_NETWORK}
aesirXEndpoint={process.env.NEXT_PUBLIC_ENDPOINT_URL ?? 'https://api.aesirx.io'}
loginApp={loginApp}
isLoggedApp={isLoggedApp}
/>
) : (
<ConsentComponent
<ConsentComponentCustom
endpoint={process.env.NEXT_PUBLIC_ENDPOINT_ANALYTICS_URL}
networkEnv={process.env.NEXT_PUBLIC_CONCORDIUM_NETWORK}
aesirXEndpoint={process.env.NEXT_PUBLIC_ENDPOINT_URL ?? 'https://api.aesirx.io'}
Expand Down
22 changes: 16 additions & 6 deletions src/AnalyticsReact/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,35 @@ import AnalyticsContextProvider from '../utils/AnalyticsContextProvider';
import AnalyticsHandle from './handle';

const ConsentComponent = React.lazy(() => import('../Components/Consent'));
const ConsentComponentCustom = React.lazy(() => import('../Components/ConsentCustom'));

interface AnalyticsReact {
location: { search: string; pathname: string };
history: { replace: (_: object) => void };
children?: ReactNode;
oldLayout?: boolean;
}

const AnalyticsReact = ({ location, history, children }: AnalyticsReact) => {
const AnalyticsReact = ({ location, history, oldLayout = false, children }: AnalyticsReact) => {
return (
<AnalyticsContextProvider>
<AnalyticsHandle location={location} history={history}>
{children}
{process.env.REACT_APP_DISABLE_ANALYTICS_CONSENT !== 'true' && (
<Suspense fallback={<></>}>
<ConsentComponent
endpoint={process.env.REACT_APP_ENDPOINT_ANALYTICS_URL}
networkEnv={process.env.REACT_APP_CONCORDIUM_NETWORK}
aesirXEndpoint={process.env.REACT_APP_ENDPOINT_URL ?? 'https://api.aesirx.io'}
/>
{oldLayout ? (
<ConsentComponent
endpoint={process.env.REACT_APP_ENDPOINT_ANALYTICS_URL}
networkEnv={process.env.REACT_APP_CONCORDIUM_NETWORK}
aesirXEndpoint={process.env.REACT_APP_ENDPOINT_URL ?? 'https://api.aesirx.io'}
/>
) : (
<ConsentComponentCustom
endpoint={process.env.NEXT_PUBLIC_ENDPOINT_ANALYTICS_URL}
networkEnv={process.env.NEXT_PUBLIC_CONCORDIUM_NETWORK}
aesirXEndpoint={process.env.NEXT_PUBLIC_ENDPOINT_URL ?? 'https://api.aesirx.io'}
/>
)}
</Suspense>
)}
</AnalyticsHandle>
Expand Down
7 changes: 3 additions & 4 deletions src/Components/Terms.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,11 @@ const TermsComponent = ({ children, level, handleLevel, isCustom = false }: any)
<Fragment key={key}>
<div
className={`rounded-top d-flex align-items-center justify-content-between p-2 p-lg-3 fw-medium flex-wrap ${
isCustom ? 'py-2 py-lg-3 px-4' : 'p-2 p-lg-3 border-bottom bg-white'
isCustom
? 'py-2 py-lg-3 px-4 header-consent-bg'
: 'p-2 p-lg-3 border-bottom bg-white'
}`}
style={{
...(isCustom && {
backgroundColor: '#F8F9FD',
}),
...(isCustom && {
borderBottom: '1px solid #DEDEDE',
}),
Expand Down
2 changes: 1 addition & 1 deletion src/Hooks/useConsentStatus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ const useConsentStatus = (endpoint?: string, props?: WalletConnectionProps) => {
}
};
initConnector();
}, []);
}, [window['concordium']]);

useEffect(() => {
if (activeConnector) {
Expand Down
6 changes: 3 additions & 3 deletions src/analytics.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ const ConsentPopup = ({ visitor_uuid, event_uuid }: any) => {
}}
>
<AesirXI18nextProvider appLanguages={appLanguages}>
{window['customLayoutConsent'] === 'true' ? (
<ConsentComponentCustom
{window['oldLayoutConsent'] === 'true' ? (
<ConsentComponent
endpoint={window['aesirx1stparty'] ?? ''}
networkEnv={window['concordiumNetwork'] ?? ''}
aesirXEndpoint={window['aesirxEndpoint'] ?? 'https://api.aesirx.io'}
/>
) : (
<ConsentComponent
<ConsentComponentCustom
endpoint={window['aesirx1stparty'] ?? ''}
networkEnv={window['concordiumNetwork'] ?? ''}
aesirXEndpoint={window['aesirxEndpoint'] ?? 'https://api.aesirx.io'}
Expand Down
9 changes: 9 additions & 0 deletions src/styles/color-mode.scss
Original file line number Diff line number Diff line change
Expand Up @@ -36,5 +36,14 @@
color: $white;
}
}
.header-consent-bg {
background-color: var(--#{$prefix}light-bg-subtle);
}
.toast.custom .consent_info_tab .nav-item button.active {
color: $white;
}
.item_compliant {
background-color: #101529;
}
}
}
3 changes: 3 additions & 0 deletions src/styles/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,9 @@ $dark: #222328;
opacity: 0;
}
}
.header-consent-bg {
background-color: #f8f9fd;
}
}
body.modal-open,
body.modal-sso-open {
Expand Down