Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
F
frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
vicotor
frontend
Commits
ec07e2c7
Commit
ec07e2c7
authored
May 13, 2024
by
Max Alekseenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix styles and add tests
parent
f051029b
Changes
10
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
53 additions
and
7 deletions
+53
-7
schema.ts
deploy/tools/envs-validator/schema.ts
+5
-0
.env.base
deploy/tools/envs-validator/test/.env.base
+1
-0
mockEnvs.ts
playwright/fixtures/mockEnvs.ts
+3
-0
LightningLabel.tsx
ui/snippets/navigation/LightningLabel.tsx
+10
-7
NavigationDesktop.pw.tsx
ui/snippets/navigation/NavigationDesktop.pw.tsx
+34
-0
NavigationDesktop.pw.tsx_dark-color-mode_with-lightning-labels-dark-mode-1.png
...tsx_dark-color-mode_with-lightning-labels-dark-mode-1.png
+0
-0
NavigationDesktop.pw.tsx_dark-color-mode_with-lightning-labels-xl-screen-dark-mode-1.png
...olor-mode_with-lightning-labels-xl-screen-dark-mode-1.png
+0
-0
NavigationDesktop.pw.tsx_default_with-lightning-labels-dark-mode-1.png
...ktop.pw.tsx_default_with-lightning-labels-dark-mode-1.png
+0
-0
NavigationDesktop.pw.tsx_default_with-lightning-labels-with-submenu-1.png
...p.pw.tsx_default_with-lightning-labels-with-submenu-1.png
+0
-0
NavigationDesktop.pw.tsx_default_with-lightning-labels-xl-screen-dark-mode-1.png
...x_default_with-lightning-labels-xl-screen-dark-mode-1.png
+0
-0
No files found.
deploy/tools/envs-validator/schema.ts
View file @
ec07e2c7
...
@@ -532,6 +532,11 @@ const schema = yup
...
@@ -532,6 +532,11 @@ const schema = yup
NEXT_PUBLIC_NETWORK_LOGO_DARK
:
yup
.
string
().
test
(
urlTest
),
NEXT_PUBLIC_NETWORK_LOGO_DARK
:
yup
.
string
().
test
(
urlTest
),
NEXT_PUBLIC_NETWORK_ICON
:
yup
.
string
().
test
(
urlTest
),
NEXT_PUBLIC_NETWORK_ICON
:
yup
.
string
().
test
(
urlTest
),
NEXT_PUBLIC_NETWORK_ICON_DARK
:
yup
.
string
().
test
(
urlTest
),
NEXT_PUBLIC_NETWORK_ICON_DARK
:
yup
.
string
().
test
(
urlTest
),
NEXT_PUBLIC_MENU_LIGHTNING_LABELS
:
yup
.
array
()
.
transform
(
replaceQuotes
)
.
json
()
.
of
(
yup
.
string
()),
// c. footer
// c. footer
NEXT_PUBLIC_FOOTER_LINKS
:
yup
NEXT_PUBLIC_FOOTER_LINKS
:
yup
...
...
deploy/tools/envs-validator/test/.env.base
View file @
ec07e2c7
...
@@ -26,6 +26,7 @@ NEXT_PUBLIC_CONTRACT_CODE_IDES=[{'title':'Remix IDE','url':'https://remix.blocks
...
@@ -26,6 +26,7 @@ NEXT_PUBLIC_CONTRACT_CODE_IDES=[{'title':'Remix IDE','url':'https://remix.blocks
NEXT_PUBLIC_CONTRACT_INFO_API_HOST=https://example.com
NEXT_PUBLIC_CONTRACT_INFO_API_HOST=https://example.com
NEXT_PUBLIC_DATA_AVAILABILITY_ENABLED=true
NEXT_PUBLIC_DATA_AVAILABILITY_ENABLED=true
NEXT_PUBLIC_FEATURED_NETWORKS=https://example.com
NEXT_PUBLIC_FEATURED_NETWORKS=https://example.com
NEXT_PUBLIC_MENU_LIGHTNING_LABELS=['/accounts','/apps']
NEXT_PUBLIC_FOOTER_LINKS=https://example.com
NEXT_PUBLIC_FOOTER_LINKS=https://example.com
NEXT_PUBLIC_GRAPHIQL_TRANSACTION=0xf7d4972356e6ae44ae948d0cf19ef2beaf0e574c180997e969a2837da15e349d
NEXT_PUBLIC_GRAPHIQL_TRANSACTION=0xf7d4972356e6ae44ae948d0cf19ef2beaf0e574c180997e969a2837da15e349d
NEXT_PUBLIC_HIDE_INDEXING_ALERT_BLOCKS=false
NEXT_PUBLIC_HIDE_INDEXING_ALERT_BLOCKS=false
...
...
playwright/fixtures/mockEnvs.ts
View file @
ec07e2c7
...
@@ -63,4 +63,7 @@ export const ENVS_MAP: Record<string, Array<[string, string]>> = {
...
@@ -63,4 +63,7 @@ export const ENVS_MAP: Record<string, Array<[string, string]>> = {
noNftMarketplaces
:
[
noNftMarketplaces
:
[
[
'
NEXT_PUBLIC_VIEWS_NFT_MARKETPLACES
'
,
''
],
[
'
NEXT_PUBLIC_VIEWS_NFT_MARKETPLACES
'
,
''
],
],
],
menuLightningLabels
:
[
[
'
NEXT_PUBLIC_MENU_LIGHTNING_LABELS
'
,
'
["/blocks", "/apps"]
'
],
],
};
};
ui/snippets/navigation/LightningLabel.tsx
View file @
ec07e2c7
import
{
useColorModeValue
}
from
'
@chakra-ui/react
'
;
import
{
useColorModeValue
,
useBreakpointValue
}
from
'
@chakra-ui/react
'
;
import
React
from
'
react
'
;
import
React
from
'
react
'
;
import
getDefaultTransitionProps
from
'
theme/utils/getDefaultTransitionProps
'
;
import
getDefaultTransitionProps
from
'
theme/utils/getDefaultTransitionProps
'
;
import
IconSvg
from
'
ui/shared/IconSvg
'
;
import
IconSvg
from
'
ui/shared/IconSvg
'
;
const
LightningLabel
=
({
bgColor
,
isCollapsed
}:
{
bgColor
?:
string
;
isCollapsed
?:
boolean
})
=>
{
const
LightningLabel
=
({
bgColor
,
isCollapsed
}:
{
bgColor
?:
string
;
isCollapsed
?:
boolean
})
=>
{
const
isLgScreen
=
useBreakpointValue
({
base
:
false
,
lg
:
true
,
xl
:
false
});
const
themeBgColor
=
useColorModeValue
(
'
white
'
,
'
black
'
);
const
themeBgColor
=
useColorModeValue
(
'
white
'
,
'
black
'
);
const
defaultTransitionProps
=
getDefaultTransitionProps
({
transitionProperty
:
'
color
'
});
const
defaultTransitionProps
=
getDefaultTransitionProps
({
transitionProperty
:
'
color
'
});
const
isExpanded
=
isCollapsed
===
false
;
const
color
=
React
.
useMemo
(()
=>
{
const
color
=
React
.
useMemo
(()
=>
{
if
(
isCollapsed
)
{
if
(
isCollapsed
||
(
!
isExpanded
&&
isLgScreen
)
)
{
return
(
bgColor
&&
bgColor
!==
'
transparent
'
)
?
bgColor
:
themeBgColor
;
return
(
bgColor
&&
bgColor
!==
'
transparent
'
)
?
bgColor
:
themeBgColor
;
}
}
return
'
transparent
'
;
return
'
transparent
'
;
},
[
bgColor
,
themeBgColor
,
isCollapsed
]);
},
[
bgColor
,
themeBgColor
,
isCollapsed
,
isExpanded
,
isLgScreen
]);
return
(
return
(
<
IconSvg
<
IconSvg
className=
"lightning-label"
className=
"lightning-label"
name=
"lightning_sidebar"
name=
"lightning_sidebar"
boxSize=
{
4
}
boxSize=
{
4
}
ml=
{
isCollapsed
?
0
:
1
}
ml=
{
{
base
:
1
,
lg
:
isExpanded
?
1
:
0
,
xl
:
isCollapsed
?
0
:
1
}
}
position=
{
isCollapsed
?
'
absolute
'
:
'
relative
'
}
position=
{
{
lg
:
isExpanded
?
'
relative
'
:
'
absolute
'
,
xl
:
isCollapsed
?
'
absolute
'
:
'
relative
'
}
}
top=
{
isCollapsed
?
'
10px
'
:
'
0
'
}
top=
{
{
lg
:
isExpanded
?
'
0
'
:
'
10px
'
,
xl
:
isCollapsed
?
'
10px
'
:
'
0
'
}
}
right=
{
isCollapsed
?
'
15px
'
:
'
0
'
}
right=
{
{
lg
:
isExpanded
?
'
0
'
:
'
15px
'
,
xl
:
isCollapsed
?
'
15px
'
:
'
0
'
}
}
color=
{
color
}
color=
{
color
}
{
...
defaultTransitionProps
}
{
...
defaultTransitionProps
}
/>
/>
...
...
ui/snippets/navigation/NavigationDesktop.pw.tsx
View file @
ec07e2c7
...
@@ -6,6 +6,7 @@ import config from 'configs/app';
...
@@ -6,6 +6,7 @@ import config from 'configs/app';
import
*
as
cookies
from
'
lib/cookies
'
;
import
*
as
cookies
from
'
lib/cookies
'
;
import
{
FEATURED_NETWORKS_MOCK
}
from
'
mocks/config/network
'
;
import
{
FEATURED_NETWORKS_MOCK
}
from
'
mocks/config/network
'
;
import
{
contextWithAuth
}
from
'
playwright/fixtures/auth
'
;
import
{
contextWithAuth
}
from
'
playwright/fixtures/auth
'
;
import
{
ENVS_MAP
}
from
'
playwright/fixtures/mockEnvs
'
;
import
{
test
,
expect
}
from
'
playwright/lib
'
;
import
{
test
,
expect
}
from
'
playwright/lib
'
;
import
*
as
configs
from
'
playwright/utils/configs
'
;
import
*
as
configs
from
'
playwright/utils/configs
'
;
...
@@ -217,3 +218,36 @@ test.describe('hover xl screen', () => {
...
@@ -217,3 +218,36 @@ test.describe('hover xl screen', () => {
await
expect
(
component
).
toHaveScreenshot
();
await
expect
(
component
).
toHaveScreenshot
();
});
});
});
});
test
.
describe
(
'
with lightning labels
'
,
()
=>
{
let
component
:
Locator
;
test
.
beforeEach
(
async
({
render
,
mockEnvs
})
=>
{
await
mockEnvs
(
ENVS_MAP
.
menuLightningLabels
);
component
=
await
render
(
<
Flex
w=
"100%"
minH=
"100vh"
alignItems=
"stretch"
>
<
NavigationDesktop
/>
<
Box
bgColor=
"lightpink"
w=
"100%"
/>
</
Flex
>,
{
hooksConfig
},
);
});
test
(
'
+@dark-mode
'
,
async
()
=>
{
await
expect
(
component
).
toHaveScreenshot
();
});
test
(
'
with submenu
'
,
async
({
page
})
=>
{
await
page
.
locator
(
'
a[aria-label="Blockchain link group"]
'
).
hover
();
await
expect
(
component
).
toHaveScreenshot
();
});
test
.
describe
(
'
xl screen
'
,
()
=>
{
test
.
use
({
viewport
:
configs
.
viewport
.
xl
});
test
(
'
+@dark-mode
'
,
async
()
=>
{
await
expect
(
component
).
toHaveScreenshot
();
});
});
});
ui/snippets/navigation/__screenshots__/NavigationDesktop.pw.tsx_dark-color-mode_with-lightning-labels-dark-mode-1.png
0 → 100644
View file @
ec07e2c7
12.8 KB
ui/snippets/navigation/__screenshots__/NavigationDesktop.pw.tsx_dark-color-mode_with-lightning-labels-xl-screen-dark-mode-1.png
0 → 100644
View file @
ec07e2c7
25.6 KB
ui/snippets/navigation/__screenshots__/NavigationDesktop.pw.tsx_default_with-lightning-labels-dark-mode-1.png
0 → 100644
View file @
ec07e2c7
12.5 KB
ui/snippets/navigation/__screenshots__/NavigationDesktop.pw.tsx_default_with-lightning-labels-with-submenu-1.png
0 → 100644
View file @
ec07e2c7
31.1 KB
ui/snippets/navigation/__screenshots__/NavigationDesktop.pw.tsx_default_with-lightning-labels-xl-screen-dark-mode-1.png
0 → 100644
View file @
ec07e2c7
25.5 KB
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment