Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
LaVizu
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
behaviors-ai-public
LaVizu
Commits
e229f3c5
Commit
e229f3c5
authored
Jul 02, 2019
by
Dorian Goepp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix identation
parent
18783c36
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
55 deletions
+55
-55
src/LatestInteraction/LatestInteraction.js
src/LatestInteraction/LatestInteraction.js
+55
-55
No files found.
src/LatestInteraction/LatestInteraction.js
View file @
e229f3c5
...
...
@@ -4,62 +4,62 @@ import {observer} from 'mobx-react'
import
{
actionClassName
}
from
'
../utils/valenceColours
'
;
export
const
LatestInteraction
=
observer
(
function
LatestInteraction
(
props
)
{
let
intended
,
enacted
;
let
iteration
=
null
;
if
(
'
int-trace
'
in
props
.
store
.
components
&&
props
.
store
.
components
[
'
int-trace
'
].
showInteraction
)
{
intended
=
props
.
store
.
components
[
'
int-trace
'
].
currentInteraction
.
intended
;
enacted
=
props
.
store
.
components
[
'
int-trace
'
].
currentInteraction
.
enacted
;
const
iteration_id
=
props
.
store
.
components
[
'
int-trace
'
].
currentInteraction
.
id
;
iteration
=
[
<
p
key
=
"
first
"
><
span
className
=
"
label
"
>
Iteration
:
<
/span> {iteration_id}</
p
>
,
<
hr
key
=
"
last
"
/>
];
function
LatestInteraction
(
props
)
{
let
intended
,
enacted
;
let
iteration
=
null
;
if
(
'
int-trace
'
in
props
.
store
.
components
&&
props
.
store
.
components
[
'
int-trace
'
].
showInteraction
)
{
intended
=
props
.
store
.
components
[
'
int-trace
'
].
currentInteraction
.
intended
;
enacted
=
props
.
store
.
components
[
'
int-trace
'
].
currentInteraction
.
enacted
;
const
iteration_id
=
props
.
store
.
components
[
'
int-trace
'
].
currentInteraction
.
id
;
iteration
=
[
<
p
key
=
"
first
"
><
span
className
=
"
label
"
>
Iteration
:
<
/span> {iteration_id}</
p
>
,
<
hr
key
=
"
last
"
/>
];
}
else
{
intended
=
props
.
intended
;
enacted
=
props
.
enacted
;
}
/**
* Return the
* @param {Object} inter object representing the interaction to display (either intended or enacted)
* @param {Number} i index of primitive action which row this is makeing
*/
function
inter2row
(
inter
,
length
,
i
)
{
if
(
i
<
length
)
{
return
(
<
td
className
=
{
actionClassName
(
inter
.
primitive_valences
[
i
])}
>
{
inter
.
action_names
[
i
]}
({
inter
.
primitive_valences
[
i
]})
<
/td>
)
;
}
else
{
intended
=
props
.
intended
;
enacted
=
props
.
enacted
;
}
/**
* Return the
* @param {Object} inter object representing the interaction to display (either intended or enacted)
* @param {Number} i index of primitive action which row this is makeing
*/
function
inter2row
(
inter
,
length
,
i
)
{
if
(
i
<
length
)
{
return
(
<
td
className
=
{
actionClassName
(
inter
.
primitive_valences
[
i
])}
>
{
inter
.
action_names
[
i
]}
({
inter
.
primitive_valences
[
i
]})
<
/td>
)
;
}
else
{
return
null
;
}
}
const
length_i
=
intended
.
action_names
.
length
,
length_e
=
enacted
.
action_names
.
length
;
let
rows
=
[];
for
(
let
i
=
0
;
i
<
Math
.
max
(
length_i
,
length_e
);
i
++
)
{
rows
.
push
(
<
tr
key
=
{
i
}
>
{
inter2row
(
intended
,
length_i
,
i
)}
{
inter2row
(
enacted
,
length_e
,
i
)}
<
/tr
>
);
return
null
;
}
return
(
<
div
className
=
"
latest-interaction
"
>
{
iteration
}
<
table
>
<
thead
>
<
tr
>
<
th
className
=
"
label
"
>
Intended
<
/th
>
<
th
className
=
"
label
"
>
Enacted
<
/th
>
<
/tr
>
<
/thead
>
<
tbody
>
{
rows
}
<
/tbody
>
<
/table
>
<
/div
>
}
const
length_i
=
intended
.
action_names
.
length
,
length_e
=
enacted
.
action_names
.
length
;
let
rows
=
[];
for
(
let
i
=
0
;
i
<
Math
.
max
(
length_i
,
length_e
);
i
++
)
{
rows
.
push
(
<
tr
key
=
{
i
}
>
{
inter2row
(
intended
,
length_i
,
i
)}
{
inter2row
(
enacted
,
length_e
,
i
)}
<
/tr
>
);
}
)
\ No newline at end of file
return
(
<
div
className
=
"
latest-interaction
"
>
{
iteration
}
<
table
>
<
thead
>
<
tr
>
<
th
className
=
"
label
"
>
Intended
<
/th
>
<
th
className
=
"
label
"
>
Enacted
<
/th
>
<
/tr
>
<
/thead
>
<
tbody
>
{
rows
}
<
/tbody
>
<
/table
>
<
/div
>
);
}
)
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment