<commit_before>const layout = require('dw-layout')

const logger = require('dw-log')
const Database = require('dw-database')
const editor = require('dw-editor')
const richText = require('dw-rich-text')

const Templates = new Database.Group('templates', {
    load: true,
    parse: true
})
const templateGroup = 't'

const list = new layout.List({
    reorderable: false,
    removeButton: true,
    editButton: true,

    addInput: true
})

const itemsBar = new layout.Block(
    { childSpacing: 8 },
    { direction: 'horizontal' }
)

const displayEditor = new layout.DisplayEdit(
    {},
    {
        background: true,
        border: true
    }
)

const partsList = new layout.List({
    reorderable: false,
    editButton: false,
    removeButton: false
})

const textControl = new layout.TextStyleEdit({})
const imageControl = new layout.ImageStyleEdit({
    image: false
})
imageControl.visible = false
const boxControl = new layout.BoxStyleEdit({})
const colorControl = new layout.BackgroundStyleEdit({})
const playControl = new layout.PlayStyleEdit({}, {})

const propertiesBar = new layout.Block({
    childSpacing: 8
})

const saveButton = new layout.Button({
    text: 'Save'
})
const removeButton = new layout.Button({
    text: 'Remove'
})

colorControl.connect(displayEditor)

{
    layout.change(itemsBar, {
        grow: false,
        shrink: false,
        padding: 0
    })
    layout.change(propertiesBar, {
        direction: 'horizontal',
        grow: false,
        shrink: false,
        wrap: true,
        padding: 0
    })

    layout.change(displayEditor, {
        grow: true
    })

    layout.body.add(
        new layout.LayoutBlock({
            items: [
                new layout.LayoutBlock({
                    items: [list],

                    size: 30,
                    minWidth: 150,
                    maxWidth: 300,
                    minHeight: 200
                }),
                new layout.LayoutBlock({
                    items: [
                        /* displayEditor controls */
                        new layout.LayoutBlock({
                            items: [
                                new layout.Block(
                                    {
                                        items: [colorControl, playControl],
                                        childSpacing: 8
                                    },
                                    {
                                        direction: 'vertical'
                                    }
                                )
                            ],

                            size: 20,
                            minWidth: 284,
                            minHeight: 116,
                            maxHeight: 116
                        }),
                        /* Node options + item options + displayEditor + item format + parts list*/
                        new layout.LayoutBlock({
                            items: [
                                /* Node options + item options + displayEditor */
                                new layout.LayoutBlock({
                                    items: [
                                        new layout.Block(
                                            {
                                                childSpacing: 8,

                                                items: [
                                                    textControl,
                                                    imageControl,
                                                    boxControl,
                                                    propertiesBar,
                                                    displayEditor
                                                ]
                                            },
                                            {
                                                direction: 'vertical'
                                            }
                                        )
                                    ],

                                    size: 70,

                                    minWidth: 395,
                                    minHeight: 300
                                }),
                                /* Item format + Parts list */
                                new layout.LayoutBlock({
                                    items: [
                                        new layout.Block(
                                            {
                                                childSpacing: 8,

                                                items: [
                                                    new layout.Text({
                                                        text: 'Edit template as'
                                                    }),
                                                    itemsBar,
                                                    partsList
                                                ]
                                            },
                                            {
                                                direction: 'vertical'
                                            }
                                        )
                                    ],

                                    size: 30,

                                    minWidth: 164,
                                    maxWidth: 200,
                                    minHeight: 100
                                })
                            ],<commit_msg>Fixed item bar width<commit_after>const layout = require('dw-layout')

const logger = require('dw-log')
const Database = require('dw-database')
const editor = require('dw-editor')
const richText = require('dw-rich-text')

const Templates = new Database.Group('templates', {
    load: true,
    parse: true
})
const templateGroup = 't'

const list = new layout.List({
    reorderable: false,
    removeButton: true,
    editButton: true,

    addInput: true
})

const itemsBar = new layout.Block(
    { childSpacing: 8 },
    { direction: 'horizontal' }
)

const displayEditor = new layout.DisplayEdit(
    {},
    {
        background: true,
        border: true
    }
)

const partsList = new layout.List({
    reorderable: false,
    editButton: false,
    removeButton: false
})

const textControl = new layout.TextStyleEdit({})
const imageControl = new layout.ImageStyleEdit({
    image: false
})
imageControl.visible = false
const boxControl = new layout.BoxStyleEdit({})
const colorControl = new layout.BackgroundStyleEdit({})
const playControl = new layout.PlayStyleEdit({}, {})

const propertiesBar = new layout.Block({
    childSpacing: 8
})

const saveButton = new layout.Button({
    text: 'Save'
})
const removeButton = new layout.Button({
    text: 'Remove'
})

colorControl.connect(displayEditor)

{
    layout.change(itemsBar, {
        grow: false,
        shrink: false,
        padding: 0
    })
    layout.change(propertiesBar, {
        direction: 'horizontal',
        grow: false,
        shrink: false,
        wrap: true,
        padding: 0
    })

    layout.change(displayEditor, {
        grow: true
    })

    layout.body.add(
        new layout.LayoutBlock({
            items: [
                new layout.LayoutBlock({
                    items: [list],

                    size: 30,
                    minWidth: 150,
                    maxWidth: 300,
                    minHeight: 200
                }),
                new layout.LayoutBlock({
                    items: [
                        /* displayEditor controls */
                        new layout.LayoutBlock({
                            items: [
                                new layout.Block(
                                    {
                                        items: [colorControl, playControl],
                                        childSpacing: 8
                                    },
                                    {
                                        direction: 'vertical'
                                    }
                                )
                            ],

                            size: 20,
                            minWidth: 284,
                            minHeight: 116,
                            maxHeight: 116
                        }),
                        /* Node options + item options + displayEditor + item format + parts list*/
                        new layout.LayoutBlock({
                            items: [
                                /* Node options + item options + displayEditor */
                                new layout.LayoutBlock({
                                    items: [
                                        new layout.Block(
                                            {
                                                childSpacing: 8,

                                                items: [
                                                    textControl,
                                                    imageControl,
                                                    boxControl,
                                                    propertiesBar,
                                                    displayEditor
                                                ]
                                            },
                                            {
                                                direction: 'vertical'
                                            }
                                        )
                                    ],

                                    size: 70,

                                    minWidth: 395,
                                    minHeight: 300
                                }),
                                /* Item format + Parts list */
                                new layout.LayoutBlock({
                                    items: [
                                        new layout.Block(
                                            {
                                                childSpacing: 8,

                                                items: [
                                                    new layout.Text({
                                                        text: 'Edit template as'
                                                    }),
                                                    itemsBar,
                                                    partsList
                                                ]
                                            },
                                            {
                                                direction: 'vertical'
                                            }
                                        )
                                    ],

                                    size: 30,

                                    minWidth: 208,
                                    maxWidth: 208,
                                    minHeight: 100
                                })
                            ],
{'fraction_non_alphanumeric': 0.06605208985948269, 'fraction_numerical': 0.00859214177033921, 'mean_word_length': 0.6175448755066589, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 162, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3282921', 'n_tokens_mistral': 2068, 'n_tokens_neox': 1877, 'n_words': 477}