-
Notifications
You must be signed in to change notification settings - Fork 488
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow adding capability to display alert/announcement in the new UI
Fixes #1123
- Loading branch information
Showing
16 changed files
with
82 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,24 @@ | ||
import { test, expect } from '@playwright/experimental-ct-react'; | ||
import { test as base, expect } from '@playwright/experimental-ct-react'; | ||
import React from 'react'; | ||
|
||
import contextWithEnvs from 'playwright/fixtures/contextWithEnvs'; | ||
import TestApp from 'playwright/TestApp'; | ||
import buildApiUrl from 'playwright/utils/buildApiUrl'; | ||
|
||
import Layout from './Layout'; | ||
|
||
const API_URL = buildApiUrl('homepage_indexing_status'); | ||
|
||
const test = base.extend({ | ||
context: contextWithEnvs([ | ||
{ | ||
name: 'NEXT_PUBLIC_MAINTENANCE_ALERT_MESSAGE', | ||
value: 'We are currently lacking pictures of <i>ducks</i>. Please <a href="mailto:[email protected]">send</a> us one.', | ||
}, | ||
// eslint-disable-next-line @typescript-eslint/no-explicit-any | ||
]) as any, | ||
}); | ||
|
||
test('base view +@mobile', async({ mount, page }) => { | ||
await page.route(API_URL, (route) => route.fulfill({ | ||
status: 200, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file modified
BIN
+7.38 KB
(120%)
ui/shared/layout/__screenshots__/Layout.pw.tsx_default_base-view-mobile-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified
BIN
+6.16 KB
(120%)
ui/shared/layout/__screenshots__/Layout.pw.tsx_mobile_base-view-mobile-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { Flex } from '@chakra-ui/react'; | ||
import React from 'react'; | ||
|
||
import IndexingBlocksAlert from './alerts/IndexingBlocksAlert'; | ||
import MaintenanceAlert from './alerts/MaintenanceAlert'; | ||
|
||
const HeaderAlert = () => { | ||
return ( | ||
<Flex flexDir="column" rowGap={ 3 } mb={ 6 } _empty={{ display: 'none' }}> | ||
<MaintenanceAlert/> | ||
<IndexingBlocksAlert/> | ||
</Flex> | ||
); | ||
}; | ||
|
||
export default React.memo(HeaderAlert); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import { Alert, AlertIcon, AlertTitle } from '@chakra-ui/react'; | ||
import React from 'react'; | ||
|
||
import config from 'configs/app'; | ||
|
||
const MaintenanceAlert = () => { | ||
if (!config.UI.maintenanceAlert.message) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<Alert status="info" colorScheme="gray" py={ 3 } borderRadius="md"> | ||
<AlertIcon display={{ base: 'none', lg: 'block' }}/> | ||
<AlertTitle | ||
dangerouslySetInnerHTML={{ __html: config.UI.maintenanceAlert.message }} | ||
sx={{ | ||
'& a': { | ||
color: 'link', | ||
_hover: { | ||
color: 'link_hovered', | ||
}, | ||
}, | ||
}} | ||
> | ||
</AlertTitle> | ||
</Alert> | ||
); | ||
}; | ||
|
||
export default MaintenanceAlert; |