Explorer

html-ui.project-page

description
type
Fn(
  language: String,
  editable: Boolean,
  project: String,
  branch: String,
  module: String,
  search: String,
  start: Number,
  response: @html-ui.response,
  status: String
) -> @definy.service-io
expression
fn(language$990, editable$9, project$0, branch$1, module$2, search$3, start$10, response$4, status$11) =>
  let lines$5 = @core.string-split(text: $4.text, separator: "\n");
  @html-ui.page(
    language: $990,
    title: match @core.equal(left: $2, right: "") {
      true =>
        $0,
      false =>
        @core.string-join(items: [$2, " - ", $0], separator: "")
    },
    body: @html.concat(
      lists: [
        [
          @html-ui.breadcrumb(language: $990, project: $0, branch: $1),
          @html.element(
            name: "h1",
            attributes: [],
            children: [
              @html.text(
                text: match @core.equal(left: $2, right: "") {
                  true =>
                    $0,
                  false =>
                    $2
                }
              )
            ]
          )
        ],
        @html-ui.status-note(language: $990, response: $4),
        match @core.equal(left: $2, right: "") {
          true =>
            match @core.equal(
                left: @html-ui.localized-text-in(
                  texts: @definy.mcp-read-descriptions(value: @definy.json-get(value: $4.json, key: "descriptions")),
                  language: $990,
                  fallback: true
                ),
                right: ""
              ) {
              true =>
                [],
              false =>
                [
                  @html.element(
                    name: "p",
                    attributes: [{name: "class", value: "muted"}],
                    children: [
                      @html.text(
                        text: @html-ui.localized-text-in(
                          texts: @definy.mcp-read-descriptions(value: @definy.json-get(value: $4.json, key: "descriptions")),
                          language: $990,
                          fallback: true
                        )
                      )
                    ]
                  )
                ]
            },
          false =>
            [@html-ui.module-summary(language: $990, response: $4)]
        },
        [
          @html-ui.history-link(language: $990, project: $0, branch: $1),
          @html-ui.branch-status-line(language: $990, project: $0, branch: $1, status: $11),
          @html-ui.search-form(language: $990, project: $0, branch: $1, search: $3)
        ],
        match @core.not(value: $9) {
          true =>
            [],
          false =>
            [
              @html.element(
                name: "form",
                attributes: [
                  {name: "method", value: "get"},
                  {name: "action", value: @core.string-join(items: ["/edit/", $0, "/", $1], separator: "")}
                ],
                children: [
                  @html.element(
                    name: "input",
                    attributes: [
                      {name: "name", value: "part"},
                      {name: "required", value: ""},
                      {name: "placeholder", value: "module.name"},
                      {
                        name: "value",
                        value: match @core.equal(left: $2, right: "") {
                          true =>
                            "",
                          false =>
                            @core.string-concat(left: $2, right: ".")
                        }
                      }
                    ],
                    children: []
                  ),
                  @html.text(text: " "),
                  @html.element(
                    name: "button",
                    attributes: [],
                    children: [
                      @html.text(
                        text: @html-ui.text(language: $990, en: "Add a part", ja: "パーツを足す", eo: "Aldoni parton")
                      )
                    ]
                  )
                ]
              ),
              @html.element(
                name: "p",
                attributes: [],
                children: [
                  @html.element(
                    name: "a",
                    attributes: [{name: "href", value: @core.string-join(items: ["/batch/", $0, "/", $1], separator: "")}],
                    children: [
                      @html.text(
                        text: @html-ui.text(
                          language: $990,
                          en: "Edit several parts in one snapshot",
                          ja: "いくつものパーツをまとめて編集",
                          eo: "Redakti plurajn partojn en unu momentfoto"
                        )
                      )
                    ]
                  )
                ]
              )
            ]
        },
        match @core.and(left: @core.equal(left: $2, right: ""), right: @core.equal(left: $3, right: "")) {
          true =>
            @core.list-concat(
              left: @html-ui.module-list(language: $990, project: $0, branch: $1, header: @html-ui.segment(segments: $5, index: 0)),
              right: match $9 {
                true =>
                  @core.list-concat(
                    left: @html-ui.branch-tools(language: $990, project: $0, branch: $1),
                    right: @html-ui.project-tools(language: $990, project: $0, branch: $1, response: $4)
                  ),
                false =>
                  []
              }
            ),
          false =>
            @html.concat(
              lists: [
                [
                  @html.element(
                    name: "pre",
                    attributes: [],
                    children: @html-ui.nodes-join(
                      lists: @core.list-fold(
                        T: String,
                        A: Record{index: Number, include: Boolean, out: List<List<@html.node>>},
                        reducer: fn(acc$6, item$7) =>
                          match @core.or(
                              left: @core.less-than(left: $6.index, right: 2),
                              right: @std.string-starts-with(value: $7, prefix: " ")
                            ) {
                            true =>
                              {
                                index: @core.plus(left: $6.index, right: 1),
                                include: @core.and(left: $6.include, right: @core.less-than-or-equal(left: 2, right: $6.index)),
                                out: match @core.and(left: $6.include, right: @core.less-than-or-equal(left: 2, right: $6.index)) {
                                  true =>
                                    @core.list-append(list: $6.out, item: @html-ui.link-refs(text: $7)),
                                  false =>
                                    $6.out
                                }
                              },
                            false =>
                              let include$8 = @core.and(
                                  left: match @core.equal(left: $2, right: "") {
                                    true =>
                                      true,
                                    false =>
                                      @std.string-starts-with(value: $7, prefix: @core.string-concat(left: $2, right: "."))
                                  },
                                  right: match @core.equal(left: $3, right: "") {
                                    true =>
                                      true,
                                    false =>
                                      @std.string-contains(value: $7, pattern: $3)
                                  }
                                );
                              {
                                index: @core.plus(left: $6.index, right: 1),
                                include: $8,
                                out: match $8 {
                                  true =>
                                    @core.list-append(
                                      list: $6.out,
                                      item: @html-ui.project-line(project: $0, branch: $1, line: @html-ui.localize-line(language: $990, line: $7))
                                    ),
                                  false =>
                                    $6.out
                                }
                              }
                          },
                        init: {index: 0, include: false, out: []},
                        xs: $5
                      ).out,
                      separator: "\n"
                    )
                  )
                ],
                @html-ui.page-links(language: $990, project: $0, branch: $1, module: $2, search: $3, start: $10, response: $4),
                match @core.and(
                    left: $9,
                    right: @core.and(left: @core.not(value: @core.equal(left: $2, right: "")), right: @core.equal(left: $3, right: ""))
                  ) {
                  true =>
                    @html-ui.module-tools(language: $990, project: $0, branch: $1, module: $2, response: $4),
                  false =>
                    []
                }
              ]
            )
        }
      ]
    )
  )
visibility
public
html-ui.project-page (project html-ui, branch main, snapshot Daaw3vbJhY15cDW6JsA4JuXvffjj_qFyxoZQMUM8hvQ)
id: pkJRTYpBJP6mkbgWUIy5VNnmGLU4h7iI8CiGU8by_LY
content hash: yXY6vhSv1-ALO9gFGO_-CaSEgazfmXGrTelVzGcurek