Skip to content

Commit 5561716

Browse files
authored
Merge pull request #10738 from ethereum/removeZenMode
Remove Zen mode from developer docs
2 parents c9173b1 + 65ed591 commit 5561716

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+45
-205
lines changed

src/components/Layout.tsx

Lines changed: 40 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { ApolloProvider } from "@apollo/client"
33
import { Flex } from "@chakra-ui/react"
44

55
import Footer from "./Footer"
6-
import ZenMode from "./ZenMode"
76
import Nav from "./Nav"
87
import SideNav from "./SideNav"
98
import SideNavMobile from "./SideNavMobile"
@@ -12,14 +11,10 @@ import TranslationBannerLegal from "./TranslationBannerLegal"
1211
import FeedbackWidget from "./FeedbackWidget"
1312
import { SkipLink } from "./SkipLink"
1413

15-
import { ZenModeContext } from "../contexts/ZenModeContext"
1614
import { lightTheme as oldTheme } from "../theme"
1715

18-
import { useKeyPress } from "../hooks/useKeyPress"
19-
2016
import { isLangRightToLeft } from "../utils/translations"
2117
import { scrollIntoView } from "../utils/scrollIntoView"
22-
import { isMobile } from "../utils/isMobile"
2318

2419
import type { Context } from "../types"
2520

@@ -51,23 +46,11 @@ const Layout: React.FC<IProps> = ({
5146
pageContext,
5247
children,
5348
}) => {
54-
const [isZenMode, setIsZenMode] = useState<boolean>(false)
5549
const [shouldShowSideNav, setShouldShowSideNav] = useState<boolean>(false)
5650

57-
// Exit Zen Mode on 'esc' click
58-
useKeyPress(`Escape`, () => handleZenModeChange(false))
59-
6051
useEffect(() => {
6152
if (path.includes("/docs/")) {
6253
setShouldShowSideNav(true)
63-
64-
if (localStorage.getItem("zen-mode") !== null) {
65-
setIsZenMode(localStorage.getItem("zen-mode") === "true" && !isMobile())
66-
}
67-
} else {
68-
// isZenMode and shouldShowSideNav only applicable in /docs pages
69-
setIsZenMode(false)
70-
setShouldShowSideNav(false)
7154
}
7255

7356
if (location.hash && !location.hash.includes("gatsby")) {
@@ -76,16 +59,6 @@ const Layout: React.FC<IProps> = ({
7659
}
7760
}, [path, location])
7861

79-
const handleZenModeChange = (val?: boolean): void => {
80-
// Use 'val' param if provided. Otherwise toggle
81-
const newVal = val !== undefined ? val : !isZenMode
82-
83-
setIsZenMode(newVal)
84-
if (localStorage) {
85-
localStorage.setItem("zen-mode", String(newVal))
86-
}
87-
}
88-
8962
const isPageLanguageEnglish = pageContext.isDefaultLang
9063
const isPageContentEnglish = !!pageContext.isContentEnglish
9164
const isLegal = !!pageContext.isLegal
@@ -101,61 +74,51 @@ const Layout: React.FC<IProps> = ({
10174

10275
return (
10376
<ApolloProvider client={client}>
104-
<ZenModeContext.Provider value={{ isZenMode, handleZenModeChange }}>
105-
<SkipLink hrefId="#main-content" />
106-
<TranslationBanner
107-
shouldShow={shouldShowTranslationBanner}
108-
isPageContentEnglish={isPageContentEnglish}
109-
isPageRightToLeft={isPageRightToLeft}
110-
originalPagePath={pageContext.i18n.originalPath || ""}
111-
/>
112-
<TranslationBannerLegal
113-
shouldShow={isLegal}
114-
isPageRightToLeft={isPageRightToLeft}
115-
originalPagePath={pageContext.i18n.originalPath || ""}
116-
/>
117-
77+
<SkipLink hrefId="#main-content" />
78+
<TranslationBanner
79+
shouldShow={shouldShowTranslationBanner}
80+
isPageContentEnglish={isPageContentEnglish}
81+
isPageRightToLeft={isPageRightToLeft}
82+
originalPagePath={pageContext.i18n.originalPath || ""}
83+
/>
84+
<TranslationBannerLegal
85+
shouldShow={isLegal}
86+
isPageRightToLeft={isPageRightToLeft}
87+
originalPagePath={pageContext.i18n.originalPath || ""}
88+
/>
89+
90+
<Flex
91+
position="relative"
92+
margin="0px auto"
93+
minHeight="100vh"
94+
flexFlow="column"
95+
maxW={{
96+
lg: oldTheme.variables.maxPageWidth,
97+
}}
98+
>
99+
<Nav path={path} />
100+
{shouldShowSideNav && <SideNavMobile path={path} />}
118101
<Flex
119-
position="relative"
120-
margin="0px auto"
121-
minHeight="100vh"
122-
flexFlow="column"
123-
maxW={{
124-
lg: oldTheme.variables.maxPageWidth,
125-
}}
102+
flexDirection={{ base: "column", lg: "row" }}
103+
id="main-content"
104+
scrollMarginTop={20}
126105
>
127-
<ZenMode>
128-
<Nav path={path} />
129-
{shouldShowSideNav && <SideNavMobile path={path} />}
130-
</ZenMode>
131-
<Flex
132-
flexDirection={{ base: "column", lg: "row" }}
133-
id="main-content"
134-
scrollMarginTop={20}
135-
>
136-
{shouldShowSideNav && (
137-
<ZenMode>
138-
<SideNav path={path} />
139-
</ZenMode>
140-
)}
141-
<Flex flexDirection="column" width="100%">
142-
<Flex
143-
justifyContent="space-around"
144-
alignItems="flex-start"
145-
overflow="visible"
146-
width="100%"
147-
flexGrow="1"
148-
>
149-
{children}
150-
</Flex>
106+
{shouldShowSideNav && <SideNav path={path} />}
107+
<Flex flexDirection="column" width="100%">
108+
<Flex
109+
justifyContent="space-around"
110+
alignItems="flex-start"
111+
overflow="visible"
112+
width="100%"
113+
flexGrow="1"
114+
>
115+
{children}
151116
</Flex>
152117
</Flex>
153-
<ZenMode>
154-
<Footer />
155-
</ZenMode>
156-
<FeedbackWidget location={path} />
157118
</Flex>
158-
</ZenModeContext.Provider>
119+
<Footer />
120+
<FeedbackWidget location={path} />
121+
</Flex>
159122
</ApolloProvider>
160123
)
161124
}

src/components/TableOfContents/index.tsx

Lines changed: 1 addition & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,18 @@
1-
import React, { useContext } from "react"
1+
import React from "react"
22

33
import {
44
Box,
55
BoxProps,
66
calc,
77
Flex,
8-
FormControl,
9-
FormLabel,
108
Icon,
119
List,
1210
ListItem,
1311
Show,
14-
Switch,
1512
useToken,
1613
} from "@chakra-ui/react"
1714
import { FaGithub } from "react-icons/fa"
1815
import { useActiveHash } from "../../hooks/useActiveHash"
19-
import { ZenModeContext } from "../../contexts/ZenModeContext"
2016
import ButtonLink from "../ButtonLink"
2117
import Translation from "../Translation"
2218

@@ -45,7 +41,6 @@ const TableOfContents: React.FC<IProps> = ({
4541
isMobile = false,
4642
...rest
4743
}) => {
48-
const { isZenMode, handleZenModeChange } = useContext(ZenModeContext)
4944
// TODO: Replace with direct token implementation after UI migration is completed
5045
const lgBp = useToken("breakpoints", "lg")
5146

@@ -81,8 +76,6 @@ const TableOfContents: React.FC<IProps> = ({
8176
return <Mobile items={items} maxDepth={maxDepth} />
8277
}
8378

84-
const shouldShowZenModeToggle = slug?.includes("/docs/")
85-
8679
return (
8780
// TODO: Switch to `above="lg"` after completion of Chakra Migration
8881
<Show above={lgBp}>
@@ -109,34 +102,6 @@ const TableOfContents: React.FC<IProps> = ({
109102
</ButtonLink>
110103
</ListItem>
111104
)}
112-
{shouldShowZenModeToggle && (
113-
<Flex
114-
as={ListItem}
115-
alignItems="center"
116-
mb={2}
117-
py="2px"
118-
opacity={0.8}
119-
fontSize="sm"
120-
>
121-
<FormControl as={Flex} alignItems="center">
122-
<FormLabel htmlFor="zen-mode" mb={0} me={2} fontSize="sm">
123-
<Translation id="zen-mode" />
124-
</FormLabel>
125-
<Switch
126-
id="zen-mode"
127-
isChecked={isZenMode}
128-
onChange={() => {
129-
handleZenModeChange()
130-
trackCustomEvent({
131-
eventCategory: "zen mode",
132-
eventAction: "click",
133-
eventName: isZenMode ? "activate" : "deactivate",
134-
})
135-
}}
136-
/>
137-
</FormControl>
138-
</Flex>
139-
)}
140105
<ListItem>
141106
<Box mb={2} textTransform="uppercase">
142107
<Translation id="on-this-page" />

src/components/ZenMode.tsx

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/contexts/ZenModeContext.tsx

Lines changed: 0 additions & 10 deletions
This file was deleted.

src/intl/ar/common.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"about-us": "نبذة عنا",
55
"aria-toggle-search-button": "تبديل زر البحث",
66
"aria-toggle-menu-button": "تبديل زر القائمة",
7-
"zen-mode": "وضع التأمل",
87
"beacon-chain": "سلسلة المنارة",
98
"bridges": "جسور سلسلة الكتل",
109
"clear": "مسح",

src/intl/az/common.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"about-us": "Haqqımızda",
55
"aria-toggle-search-button": "Axtarış düyməsini aç/bağla",
66
"aria-toggle-menu-button": "Menyu düyməsini aç/bağla",
7-
"zen-mode": "Vaxt ayırma rejimi",
87
"beacon-chain": "İşarə (Beacon) zənciri",
98
"bridges": "Blockchain körpüləri",
109
"clear": "Təmizlə",

src/intl/bg/common.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"about-us": "За нас",
55
"aria-toggle-search-button": "Бутон за търсенеToggle",
66
"aria-toggle-menu-button": "Бутон за Toggle меню",
7-
"zen-mode": "Дзен режим",
87
"beacon-chain": "Сигнална верига",
98
"bridges": "Мостове на блокова верига",
109
"clear": "Изчистване",

src/intl/ca/common.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
"about-us": "Sobre nosaltres",
44
"aria-toggle-search-button": "Mostrar el botó de cerca",
55
"aria-toggle-menu-button": "Mostrar el botó del menú",
6-
"zen-mode": "Mode Zen",
76
"beacon-chain": "La Cadena de Balisa",
87
"bridges": "Ponts que interconnecten les Blockchains",
98
"close": "Tancar",

src/intl/cs/common.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"about-us": "O nás",
55
"aria-toggle-search-button": "Zobrazit hledání",
66
"aria-toggle-menu-button": "Zobrazit menu",
7-
"zen-mode": "Režim Zen",
87
"beacon-chain": "Řetězová vazba",
98
"bridges": "Blockchainové mosty",
109
"clear": "Vymazat",

src/intl/da/common.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
"about-us": "Om os",
55
"aria-toggle-search-button": "Tænd/sluk søgknappen",
66
"aria-toggle-menu-button": "Tænd/sluk menuknappen",
7-
"zen-mode": "Zen-tilstand",
87
"beacon-chain": "Beacon Chain",
98
"bridges": "Blockchain-broer",
109
"clear": "Ryd",

0 commit comments

Comments
 (0)