Skip to content

Commit 853933a

Browse files
committed
refactor: use nav again
1 parent 5532f40 commit 853933a

File tree

8 files changed

+15
-17
lines changed

8 files changed

+15
-17
lines changed

app/layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ export default function RootLayout({
66
children: React.ReactNode
77
}) {
88
return (
9-
<html>
9+
<html lang="en">
1010
<head />
1111
<body>{children}</body>
1212
</html>

app/story/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ export default function Story() {
1414
sidebarContentRight={<div>Promoted</div>}
1515
sidebarContentLeft={<div>Reactions</div>}
1616
>
17-
<Editor editable={true} requestCookie={requestCookie} />
17+
<Editor editable requestCookie={requestCookie} />
1818
</Layout>
1919
</div>
2020
)

src/components/Layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export default function Layout({
1717
const [isDrawerOpen, setIsDrawerOpen] = useState(false)
1818
return (
1919
<div className="mx-auto bg-gray-200 dark:bg-dark-800 min-h-screen">
20-
{/* <Navbar isDrawerOpen={isDrawerOpen} setIsDrawerOpen={setIsDrawerOpen} /> */}
20+
<Navbar isDrawerOpen={isDrawerOpen} setIsDrawerOpen={setIsDrawerOpen} />
2121
{sidebarContentLeft && (
2222
<aside
2323
className={`col-span-2 md:hidden mt-16 ${

src/components/UserDetails/Bio.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ const Bio = ({ user }: BioProps) => {
4040
setEditMode(false)
4141
commitMutation({
4242
variables: {
43-
input: { id: data.id, bio: bio },
43+
input: { id: data.id, bio },
4444
},
4545
})
4646
}

src/components/navbar/Navbar.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import dynamic from 'next/dynamic'
22
import Link from 'next/link'
3-
import { useRouter } from 'next/router'
3+
import { usePathname } from 'next/navigation'
44
import React from 'react'
55
import Button from '../Button'
66
import HamburgerMenu from './HamburgerButton'
@@ -14,8 +14,7 @@ type NavbarProps = {
1414
}
1515

1616
export default function Navbar({ isDrawerOpen, setIsDrawerOpen }: NavbarProps) {
17-
const router = useRouter()
18-
const { pathname } = router
17+
const pathname = usePathname()
1918
return (
2019
<nav className="fixed top-0 left-0 right-0 z-10 w-full h-16 bg-white dark:bg-dark-700 p-3 shadow-sm">
2120
<div className="container m-auto flex justify-between">

src/components/story/StoryEditor.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const DEFAULT_INITIAL_DATA = (): OutputData => {
3131

3232
const getTitle = (content: OutputData) => {
3333
for (let i = 0; i < content.blocks.length; i++) {
34-
if (content.blocks[i].type == 'header' && content.blocks[i].data.text) {
34+
if (content.blocks[i].type === 'header' && content.blocks[i].data.text) {
3535
return content.blocks[i].data.text
3636
}
3737
}
@@ -42,14 +42,14 @@ const getAbstract = (content: OutputData) => {
4242
let headerTaken = false
4343
for (let i = 0; i < content.blocks.length; i++) {
4444
if (
45-
content.blocks[i].type == 'header' &&
45+
content.blocks[i].type === 'header' &&
4646
content.blocks[i].data.text &&
4747
!headerTaken
4848
) {
4949
headerTaken = true
5050
} else if (
51-
content.blocks[i].type == 'header' ||
52-
content.blocks[i].type == 'paragraph'
51+
content.blocks[i].type === 'header' ||
52+
content.blocks[i].type === 'paragraph'
5353
) {
5454
abstract += stripHtml(content.blocks[i].data.text).result + ' '
5555
}
@@ -60,7 +60,7 @@ const getAbstract = (content: OutputData) => {
6060

6161
const getThubnail = (content: OutputData) => {
6262
for (let i = 0; i < content.blocks.length; i++) {
63-
if (content.blocks[i].type == 'image' && content.blocks[i].data.file.url) {
63+
if (content.blocks[i].type === 'image' && content.blocks[i].data.file.url) {
6464
return content.blocks[i].data.file.url
6565
}
6666
}
@@ -183,7 +183,7 @@ function Editor({ editable, body }: EditorProps) {
183183
}
184184
`}
185185
</style>
186-
{editable && <Button onClick={() => handleStorySubmit()}>Submit </Button>}
186+
{editable && <Button onClick={handleStorySubmit}>Submit </Button>}
187187
</Card>
188188
)
189189
}

src/relay/environment.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,17 +58,17 @@ export const responseCache: QueryResponseCache | null = IS_SERVER
5858
})
5959

6060
function createNetwork(cookie?: string) {
61-
async function fetchResponse(
61+
function fetchResponse(
6262
params: RequestParameters,
6363
variables: Variables,
6464
cacheConfig: CacheConfig
6565
) {
6666
const isQuery = params.operationKind === 'query'
6767
const cacheKey = params.id ?? params.cacheID
6868
const forceFetch = cacheConfig && cacheConfig.force
69-
if (responseCache != null && isQuery && !forceFetch) {
69+
if (responseCache !== null && isQuery && !forceFetch) {
7070
const fromCache = responseCache.get(cacheKey, variables)
71-
if (fromCache != null) {
71+
if (fromCache !== null) {
7272
return Promise.resolve(fromCache)
7373
}
7474
}

src/relay/loadSerializableQuery.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { cookies } from 'next/headers'
21
import {
32
GraphQLResponse,
43
OperationType,

0 commit comments

Comments
 (0)