commit 2ef1799777eb6c7a4fe01419fec436daa7e05919
parent 601c94d4d8e0e55c92fbb8eb4cdf54f612e84e93
Author: MTRNord <mtrnord1@gmail.com>
Date: Sat, 1 Jan 2022 22:18:10 +0100
Hide join and login buttons if already logged in
Diffstat:
3 files changed, 37 insertions(+), 4 deletions(-)
diff --git a/components/Header.tsx b/components/Header.tsx
@@ -22,8 +22,8 @@ export default class Header extends Component {
</div>
<nav className='flex flex-shrink-0 relative mr-0 h-full'>
- <span className='px-4 h-auto min-w-[24px] flex items-center whitespace-nowrap cursor-pointer text-gray-900 dark:text-gray-200 font-medium'><Link href="/register">Join</Link></span>
- <span className='px-4 h-auto min-w-[24px] flex items-center whitespace-nowrap cursor-pointer text-gray-900 dark:text-gray-200 font-medium'><Link href="/login">Log in</Link></span>
+ {!this.context.client.isGuest ? <span className='px-4 h-auto min-w-[24px] flex items-center whitespace-nowrap cursor-pointer text-gray-900 dark:text-gray-200 font-medium'><Link href="/register">Join</Link></span> : null}
+ {!this.context.client.isGuest ? <span className='px-4 h-auto min-w-[24px] flex items-center whitespace-nowrap cursor-pointer text-gray-900 dark:text-gray-200 font-medium'><Link href="/login">Log in</Link></span> : null}
{this.context.client.isGuest ? <span className='px-4 h-auto min-w-[24px] flex items-center whitespace-nowrap cursor-pointer text-gray-900 dark:text-gray-200 font-medium'><Link href="/profile">Profile</Link></span> : null}
</nav>
</div>
diff --git a/package-lock.json b/package-lock.json
@@ -7,6 +7,7 @@
"name": "matrix-art",
"dependencies": {
"cors": "^2.8.5",
+ "meilisearch": "^0.23.0",
"next": "12.0.7",
"node-localstorage": "^2.2.1",
"pouchdb": "^7.2.2",
@@ -3255,6 +3256,14 @@
"yarn": ">=1"
}
},
+ "node_modules/cross-fetch": {
+ "version": "3.1.4",
+ "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.4.tgz",
+ "integrity": "sha512-1eAtFWdIubi6T4XPy6ei9iUFoKpUkIF971QLN8lIvvvwueI65+Nw5haMNKUwfJxabqlIIDODJKGrQ66gxC0PbQ==",
+ "dependencies": {
+ "node-fetch": "2.6.1"
+ }
+ },
"node_modules/cross-spawn": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
@@ -6079,6 +6088,14 @@
"safe-buffer": "^5.1.2"
}
},
+ "node_modules/meilisearch": {
+ "version": "0.23.0",
+ "resolved": "https://registry.npmjs.org/meilisearch/-/meilisearch-0.23.0.tgz",
+ "integrity": "sha512-bLNonPJK2pJz2akjwolcc/Eqnz/GKJ7y1I4Flg4zjL+v0yPFyIGFFdfe0dw93JWFJWj/RbLS2Q6dDTobZQ9Ehg==",
+ "dependencies": {
+ "cross-fetch": "^3.1.4"
+ }
+ },
"node_modules/merge-stream": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz",
@@ -10926,6 +10943,14 @@
"cross-spawn": "^7.0.1"
}
},
+ "cross-fetch": {
+ "version": "3.1.4",
+ "resolved": "https://registry.npmjs.org/cross-fetch/-/cross-fetch-3.1.4.tgz",
+ "integrity": "sha512-1eAtFWdIubi6T4XPy6ei9iUFoKpUkIF971QLN8lIvvvwueI65+Nw5haMNKUwfJxabqlIIDODJKGrQ66gxC0PbQ==",
+ "requires": {
+ "node-fetch": "2.6.1"
+ }
+ },
"cross-spawn": {
"version": "7.0.3",
"resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz",
@@ -13040,6 +13065,14 @@
"safe-buffer": "^5.1.2"
}
},
+ "meilisearch": {
+ "version": "0.23.0",
+ "resolved": "https://registry.npmjs.org/meilisearch/-/meilisearch-0.23.0.tgz",
+ "integrity": "sha512-bLNonPJK2pJz2akjwolcc/Eqnz/GKJ7y1I4Flg4zjL+v0yPFyIGFFdfe0dw93JWFJWj/RbLS2Q6dDTobZQ9Ehg==",
+ "requires": {
+ "cross-fetch": "^3.1.4"
+ }
+ },
"merge-stream": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/merge-stream/-/merge-stream-2.0.0.tgz",
diff --git a/package.json b/package.json
@@ -12,6 +12,7 @@
},
"dependencies": {
"cors": "^2.8.5",
+ "meilisearch": "^0.23.0",
"next": "12.0.7",
"node-localstorage": "^2.2.1",
"pouchdb": "^7.2.2",
@@ -36,4 +37,4 @@
"tailwindcss": "^3.0.7",
"typescript": "4.5.4"
}
-}
-\ No newline at end of file
+}