Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F22424048
navbar.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
928 B
Referenced Files
None
Subscribers
None
navbar.ts
View Options
import
{
BaseContext
}
from
"koa"
;
import
{
SignUpURL
,
SignInURL
,
TodoURL
,
LogoutURL
}
from
"../urls.js"
;
export
default
async
function
navbar
(
ctx
:
BaseContext
)
{
const
isLoggedIn
=
!!
ctx
.
$context
.
session_id
;
const
linkData
=
isLoggedIn
?
[
{
text
:
"Logout"
,
url
:
LogoutURL
},
{
text
:
"To do app"
,
url
:
TodoURL
},
]
:
[
{
text
:
"Sign in"
,
url
:
SignInURL
},
{
text
:
"Sign up"
,
url
:
SignUpURL
},
];
const
linksHTML
=
linkData
.
map
((
link
)
=>
link
.
url
===
new
URL
(
ctx
.
url
,
"https://a.com"
).
pathname
?
`<li class="active"><span>
${
link
.
text
}
</span></li>`
:
/* HTML */
`<li><a href="
${
link
.
url
}
">
${
link
.
text
}
</a></li>`
)
.
join
(
"\n"
);
return
/* HTML */
` <nav>
<a href="/" class="nav-logo">
<img
src="/assets/logo"
alt="
${
ctx
.
$app
.
manifest
.
name
}
- logo"
width="50"
height="50"
/>
${
ctx
.
$app
.
manifest
.
name
}
</a>
<ul>
${
linksHTML
}
</ul>
</nav>`
;
}
File Metadata
Details
Attached
Mime Type
application/javascript
Expires
Sat, Nov 28, 03:50 (1 d, 6 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1211921
Default Alt Text
navbar.ts (928 B)
Attached To
Mode
rPHOTOAPP photo-app-demo
Attached
Detach File
Event Timeline