@@ -4,8 +4,6 @@ import React, {useContext, useEffect, useRef, useState} from "react";
4
4
import "../../../../digital-form-builder/designer/client/components/Visualisation/visualisation.scss" ;
5
5
import { getLayout , Pos } from "../../../../digital-form-builder/designer/client/components/Visualisation/getLayout" ;
6
6
import { AdapterPage } from "../Page" ;
7
- import { Info } from "../../../../digital-form-builder/designer/client/components/Visualisation/Info" ;
8
- import { Minimap } from "../../../../digital-form-builder/designer/client/components/Visualisation/Minimap" ;
9
7
import { AdapterDataContext } from "../../context/AdapterDataContext" ;
10
8
import { AdapterLines } from "./AdapterLines" ;
11
9
@@ -36,6 +34,7 @@ export const AdapterVisualisation = (props: Props) => {
36
34
37
35
const { updatedAt, downloadedAt, previewUrl, persona, id} = props ;
38
36
const { pages} = data ;
37
+ const scale = 0.05
39
38
40
39
const wrapperStyle = layout && {
41
40
width : layout ?. width ,
@@ -61,9 +60,48 @@ export const AdapterVisualisation = (props: Props) => {
61
60
</ div >
62
61
</ div >
63
62
64
- { layout && < Info downloadedAt = { downloadedAt } updatedAt = { updatedAt } /> }
63
+ { layout &&
64
+ < div style = { { display : 'flex' , justifyContent : 'space-between' , width : '100%' } } >
65
+ < div className = "notification" style = { { position : 'relative' } } >
66
+ < p className = "govuk-body" > last downloaded at { downloadedAt } </ p >
67
+ < p className = "govuk-body" > last updated at { updatedAt } </ p >
68
+ </ div >
69
+ < div className = "minimap" style = { { position : 'relative' } } >
70
+ < svg
71
+ height = { parseFloat ( layout . height ) * scale }
72
+ width = { parseFloat ( layout . width ) * scale }
73
+ >
74
+ { layout . edges . map ( ( edge ) => {
75
+ const points = edge . points
76
+ . map ( ( points ) => `${ points . x * scale } ,${ points . y * scale } ` )
77
+ . join ( " " ) ;
78
+ return (
79
+ < g key = { points } >
80
+ < polyline points = { points } />
81
+ </ g >
82
+ ) ;
83
+ } ) }
65
84
66
- { layout && < Minimap layout = { layout } /> }
85
+ { layout . nodes . map ( ( node , index ) => {
86
+ // @ts -ignore
87
+ return (
88
+ < g key = { node + index } > < a id = { node + index } xlinkHref = { `#${ node . node . label } ` } >
89
+ < rect
90
+ x = { parseFloat ( node . left ) * scale }
91
+ y = { parseFloat ( node . top ) * scale }
92
+ width = { node . node . width * scale }
93
+ height = { node . node . height * scale }
94
+ //@ts -ignore
95
+ title = { node . node . label }
96
+ />
97
+ </ a >
98
+ </ g >
99
+ ) ;
100
+ } ) }
101
+ </ svg >
102
+ </ div >
103
+ </ div >
104
+ }
67
105
</ div >
68
106
</ >
69
107
) ;
0 commit comments