Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
camino
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
pub
pnm-public
camino
Commits
340328cb
Unverified
Commit
340328cb
authored
2 years ago
by
BITARD Michaël
Committed by
GitHub
2 years ago
Browse files
Options
Downloads
Patches
Plain Diff
refactor(ui): l'app principale est en tsx (#491)
parent
6f9be052
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
packages/ui/src/app.tsx
+95
-0
95 additions, 0 deletions
packages/ui/src/app.tsx
packages/ui/src/app.vue
+0
-100
0 additions, 100 deletions
packages/ui/src/app.vue
packages/ui/src/index.ts
+1
-1
1 addition, 1 deletion
packages/ui/src/index.ts
with
96 additions
and
101 deletions
packages/ui/src/app.tsx
0 → 100644
+
95
−
0
View file @
340328cb
import
'
@gouvfr/dsfr/dist/core/core.module
'
import
'
@gouvfr/dsfr/dist/component/navigation/navigation.module
'
import
'
@gouvfr/dsfr/dist/component/modal/modal.module
'
import
'
@gouvfr/dsfr/dist/component/header/header.module
'
import
{
defineComponent
,
Transition
,
computed
,
inject
}
from
'
vue
'
import
{
Messages
}
from
'
./components/_ui/messages
'
import
{
Header
}
from
'
./components/page/header
'
import
{
Footer
}
from
'
./components/page/footer
'
import
{
MapPattern
}
from
'
./components/_map/pattern
'
import
{
IconSprite
}
from
'
./components/_ui/iconSprite
'
import
{
CaminoError
}
from
'
./components/error
'
import
{
useStore
}
from
'
vuex
'
import
{
RouterView
,
useRoute
}
from
'
vue-router
'
import
{
TrackEventFunction
}
from
'
@/utils/matomo
'
export
const
App
=
defineComponent
({
setup
:
()
=>
{
const
store
=
useStore
()
const
matomo
=
inject
(
'
matomo
'
,
null
)
const
route
=
useRoute
()
const
user
=
computed
(()
=>
store
.
state
.
user
.
element
)
const
loaded
=
computed
<
boolean
>
(()
=>
store
.
state
.
user
.
loaded
)
const
error
=
computed
(()
=>
store
.
state
.
error
)
const
messages
=
computed
(()
=>
store
.
state
.
messages
)
const
popup
=
computed
(()
=>
store
.
state
.
popup
)
const
loading
=
computed
(()
=>
store
.
state
.
loading
.
length
>
0
)
const
fileLoading
=
computed
(()
=>
store
.
state
.
fileLoading
)
const
currentMenuSection
=
computed
(()
=>
route
.
meta
?.
menuSection
)
if
(
matomo
)
{
// @ts-ignore
matomo
.
customVariableVisitUser
(
user
)
// @ts-ignore
matomo
.
trackPageView
()
}
// TODO 2023-03-16 typer l’instance matomo dans un .d.ts
const
trackEvent
:
TrackEventFunction
=
(
segment
,
subSegment
,
event
)
=>
{
if
(
matomo
)
{
// @ts-ignore
matomo
.
trackEvent
(
segment
,
subSegment
,
event
)
}
}
return
()
=>
(
<
div
class
=
"page relative"
>
<
MapPattern
/>
<
IconSprite
/>
<
Header
user
=
{
user
.
value
}
currentMenuSection
=
{
currentMenuSection
.
value
}
trackEvent
=
{
trackEvent
}
/>
<
main
class
=
"main"
>
<
div
class
=
"container"
>
{
error
.
value
?
<
CaminoError
couleur
=
{
error
.
value
.
type
}
message
=
{
error
.
value
.
value
}
/>
:
<>
{
loaded
.
value
?
<
RouterView
/>
:
null
}
</>
}
</
div
>
</
main
>
<
Footer
/>
<
div
class
=
"messages"
>
<
Messages
id
=
"cmn-app-messages"
messages
=
{
messages
.
value
}
/>
</
div
>
<
Transition
name
=
"fade"
>
{
popup
.
value
.
component
?
<
div
class
=
"absolute full bg-inverse-alpha"
style
=
"z-index: 600"
/>
:
null
}
</
Transition
>
<
Transition
name
=
"slide-top"
>
{
popup
.
value
.
component
?
<
popup
.
value
.
component
{
...
popup
.
value
.
props
}
/>
:
null
}
</
Transition
>
<
Transition
name
=
"fade"
>
{
loading
.
value
||
fileLoading
.
value
.
total
?
(
<
div
class
=
"loaders fixed p"
>
{
loading
.
value
?
<
div
class
=
"loader"
/>
:
null
}
{
fileLoading
.
value
.
total
?
(
<
div
>
<
div
class
=
"relative loader-file"
>
<
div
class
=
"loader-file-bar"
style
=
{
{
right
:
`
${
100
-
100
*
(
fileLoading
.
value
.
loaded
/
fileLoading
.
value
.
total
)}
%`
,
}
}
/>
</
div
>
</
div
>
)
:
null
}
</
div
>
)
:
null
}
</
Transition
>
</
div
>
)
},
})
This diff is collapsed.
Click to expand it.
packages/ui/src/app.vue
deleted
100644 → 0
+
0
−
100
View file @
6f9be052
<
template
>
<div
class=
"page relative"
>
<MapPattern
/>
<IconSprite
/>
<Header
:user=
"user"
:currentMenuSection=
"currentMenuSection"
:trackEvent=
"trackEvent"
/>
<main
class=
"main"
>
<div
class=
"container"
>
<CaminoError
v-if=
"error"
:couleur=
"error.type"
:message=
"error.value"
/>
<RouterView
v-else-if=
"loaded"
/>
</div>
</main>
<Footer
/>
<div
class=
"messages"
>
<Messages
id=
"cmn-app-messages"
:messages=
"messages"
/>
</div>
<Transition
name=
"fade"
>
<div
v-if=
"!!popup.component"
class=
"absolute full bg-inverse-alpha"
style=
"z-index: 600"
/>
</Transition>
<Transition
name=
"slide-top"
>
<component
:is=
"popup.component"
v-bind=
"popup.props"
v-if=
"popup.component"
/>
</Transition>
<Transition
name=
"fade"
>
<template
v-if=
"loading || fileLoading.total"
>
<div
class=
"loaders fixed p"
>
<div
v-if=
"loading"
class=
"loader"
/>
<div
v-if=
"fileLoading.total"
>
<div
class=
"relative loader-file"
>
<div
class=
"loader-file-bar"
:style=
"
{
right: `${100 - 100 * (fileLoading.loaded / fileLoading.total)}%`,
}"
/>
</div>
</div>
</div>
</
template
>
</Transition>
</div>
</template>
<
script
lang=
"ts"
setup
>
import
'
@gouvfr/dsfr/dist/core/core.module
'
import
'
@gouvfr/dsfr/dist/component/navigation/navigation.module
'
import
'
@gouvfr/dsfr/dist/component/modal/modal.module
'
import
'
@gouvfr/dsfr/dist/component/header/header.module
'
import
{
Messages
}
from
'
./components/_ui/messages
'
import
{
Header
}
from
'
./components/page/header
'
import
{
Footer
}
from
'
./components/page/footer
'
import
{
MapPattern
}
from
'
./components/_map/pattern
'
import
{
IconSprite
}
from
'
./components/_ui/iconSprite
'
import
{
CaminoError
}
from
'
./components/error
'
import
{
computed
,
inject
}
from
'
vue
'
import
{
useStore
}
from
'
vuex
'
import
{
useRoute
}
from
'
vue-router
'
import
{
TrackEventFunction
}
from
'
@/utils/matomo
'
const
store
=
useStore
()
const
matomo
=
inject
(
'
matomo
'
,
null
)
const
route
=
useRoute
()
const
user
=
computed
(()
=>
store
.
state
.
user
.
element
)
const
loaded
=
computed
(()
=>
store
.
state
.
user
.
loaded
)
const
error
=
computed
(()
=>
store
.
state
.
error
)
const
messages
=
computed
(()
=>
store
.
state
.
messages
)
const
popup
=
computed
(()
=>
store
.
state
.
popup
)
const
loading
=
computed
(()
=>
store
.
state
.
loading
.
length
>
0
)
const
fileLoading
=
computed
(()
=>
store
.
state
.
fileLoading
)
const
currentMenuSection
=
computed
(()
=>
route
.
meta
?.
menuSection
)
if
(
matomo
)
{
// @ts-ignore
matomo
.
customVariableVisitUser
(
user
)
// @ts-ignore
matomo
.
trackPageView
()
}
// TODO 2023-03-16 typer l’instance matomo dans un .d.ts
const
trackEvent
:
TrackEventFunction
=
(
segment
,
subSegment
,
event
)
=>
{
if
(
matomo
)
{
// @ts-ignore
matomo
.
trackEvent
(
segment
,
subSegment
,
event
)
}
}
</
script
>
This diff is collapsed.
Click to expand it.
packages/ui/src/index.ts
+
1
−
1
View file @
340328cb
...
...
@@ -5,7 +5,7 @@ import * as Sentry from '@sentry/vue'
import
{
BrowserTracing
}
from
'
@sentry/tracing
'
import
VueMatomo
from
'
./stats
'
import
App
from
'
./app
.vue
'
import
{
App
}
from
'
./app
'
import
router
from
'
./router
'
import
store
from
'
./store
'
...
...
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