Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
B
Bielefeld-CeBiTec
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
2024 Competition
Bielefeld-CeBiTec
Commits
6c9936f3
Commit
6c9936f3
authored
4 months ago
by
Liliana Sanfilippo
Browse files
Options
Downloads
Patches
Plain Diff
lik fix
parent
e7e74be8
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#531607
failed
4 months ago
Stage: build
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/components/Link.tsx
+7
-4
7 additions, 4 deletions
src/components/Link.tsx
src/components/interfaces.tsx
+2
-1
2 additions, 1 deletion
src/components/interfaces.tsx
src/utils/useNavigation.ts
+11
-8
11 additions, 8 deletions
src/utils/useNavigation.ts
with
20 additions
and
13 deletions
src/components/Link.tsx
+
7
−
4
View file @
6c9936f3
...
...
@@ -10,14 +10,17 @@ export function TabScrollLink({tab, scrollId, num}:{tab: string, scrollId: strin
// 2^4 = 16 possible combinations
export
function
OurLink
({
path
,
scrollToId
,
tabId
,
subTabId
,
collapseId
,
text
}:
Ourlink
){
// 2^4 = 16 possible combinations + 1 special case
export
function
OurLink
({
path
,
scrollToId
,
tabId
,
subTabId
,
collapseId
,
text
,
tabincolId
}:
Ourlink
){
const
{
goToPlace
}
=
useNavigation
();
// 1. [1-1-1-1] go to page and open tab and open collapsible and open subtab in collapsible and scroll to something
if
(
tabId
&&
subTabId
&&
scrollToId
&&
collapseId
)
{
if
(
tabId
&&
subTabId
&&
scrollToId
&&
collapseId
&&
!
tabincolId
)
{
return
(<
a
onClick
=
{
()
=>
goToPlace
({
path
:
path
,
tabId
:
tabId
,
subTabId
:
subTabId
,
scrollToId
:
scrollToId
,
collapseId
:
collapseId
})
}
>
{
text
}
</
a
>)
}
// special case if tab in collapsible shall be opened
if
(
tabId
&&
subTabId
&&
scrollToId
&&
collapseId
&&
tabincolId
)
{
return
(<
a
onClick
=
{
()
=>
goToPlace
({
path
:
path
,
tabId
:
tabId
,
subTabId
:
subTabId
,
scrollToId
:
scrollToId
,
collapseId
:
collapseId
,
tabincolId
:
tabincolId
})
}
>
{
text
}
</
a
>)
}
// 2. [1-1-1-0] go to page and open tab and open subtab and scroll to something
else
if
(
tabId
&&
subTabId
&&
scrollToId
&&
!
collapseId
){
return
(<
a
onClick
=
{
()
=>
goToPlace
({
path
:
path
,
tabId
:
tabId
,
subTabId
:
subTabId
,
scrollToId
:
scrollToId
})
}
>
{
text
}
</
a
>)
...
...
This diff is collapsed.
Click to expand it.
src/components/interfaces.tsx
+
2
−
1
View file @
6c9936f3
...
...
@@ -4,5 +4,6 @@ export interface Ourlink{
scrollToId
?:
string
,
tabId
?:
string
,
subTabId
?:
string
,
collapseId
?:
string
collapseId
?:
string
,
tabincolId
?:
string
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
src/utils/useNavigation.ts
+
11
−
8
View file @
6c9936f3
...
...
@@ -52,26 +52,29 @@ export const useNavigation = () => {
const
goToPlace
=
({
path
,
scrollToId
,
tabId
,
subTabId
,
collapseId
}:
{
path
:
string
,
scrollToId
?:
string
,
tabId
?:
string
,
subTabId
?:
string
,
collapseId
?:
string
})
=>
{
const
goToPlace
=
({
path
,
scrollToId
,
tabId
,
subTabId
,
collapseId
,
tabincolId
}:
{
path
:
string
,
scrollToId
?:
string
,
tabId
?:
string
,
subTabId
?:
string
,
collapseId
?:
string
,
tabincolId
?:
string
})
=>
{
let
url
=
`
${
path
}
`
;
if
(
tabId
)
{
url
+=
`?tab=
${
tabId
}
`
;
if
(
collapseId
)
{
url
+=
`&collapseId=
${
collapseId
}
`
;
}
if
(
subTabId
)
{
url
+=
`&subTab=
${
subTabId
}
`
;
}
}
if
(
collapseId
&&
!
tabId
)
{
url
+=
`?collapseId=
${
collapseId
}
`
;
if
(
subTabId
)
{
url
+=
`&subTab=
${
subTabId
}
`
;
if
(
tabincolId
)
{
url
+=
`&colTab=
${
tabincolId
}
`
;
}
}
if
(
collapseId
)
{
url
+=
`&collapseId=
${
collapseId
}
`
;
if
(
tabincolId
)
{
url
+=
`&colTab=
${
tabincolId
}
`
;
}
}
if
(
scrollToId
&&
!
tabId
)
{
if
(
scrollToId
&&
!
tabId
||
scrollToId
&&
!
collapseId
)
{
url
+=
`?scrollTo=
${
scrollToId
}
`
;
}
else
if
(
scrollToId
&&
tabId
)
{
}
else
if
(
scrollToId
&&
tabId
||
scrollToId
&&
collapseId
)
{
url
+=
`&scrollTo=
${
scrollToId
}
`
;
}
navigate
(
url
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment