Opt: [ALAS] Improve ui appearance of stored object

This commit is contained in:
LmeSzinc 2024-05-09 17:44:39 +08:00
parent 4e05aa37a3
commit f58aec2f6a
4 changed files with 48 additions and 49 deletions

View File

@ -441,10 +441,13 @@ pre.rich-traceback-code {
[id^="pywebio-scope-dashboard-value-"] { [id^="pywebio-scope-dashboard-value-"] {
display: flex; display: flex;
align-items: flex-end; align-items: baseline;
height: 1.5rem; height: 1.5rem;
} }
[id^="pywebio-scope-arg_stored-stored-value-"] p {
margin-bottom: 0;
}
#pywebio-scope-log { #pywebio-scope-log {
line-height: 1.2; line-height: 1.2;

View File

@ -83,11 +83,6 @@ select.state-light {
background-color: transparent !important; background-color: transparent !important;
} }
[id^="pywebio-scope-arg_stored-stored-value-"] {
border-bottom: .125rem solid #7a77bb;
background-color: #343a40;
}
textarea { textarea {
border: 1px solid #21262d; border: 1px solid #21262d;
} }

View File

@ -84,11 +84,6 @@ select.state-light {
background-color: transparent !important; background-color: transparent !important;
} }
[id^="pywebio-scope-arg_stored-stored-value-"] {
border-bottom: .125rem solid #4e4c97;
background-color: #e9ecef;
}
textarea { textarea {
border: 1px solid lightgrey; border: 1px solid lightgrey;
} }

View File

@ -325,11 +325,17 @@ def put_arg_input(kwargs: T_Output_Kwargs) -> Output:
) )
def product_stored_row(kwargs: T_Output_Kwargs, key, value, style = "--input--"): def product_stored_row(key, value):
kwargs = copy.copy(kwargs) if key[-1].isdigit():
kwargs["name"] += f'_{key}' # quest1, quest2, quest3
kwargs["value"] = value return [put_text(value).style("--dashboard-time--")]
return put_input(**kwargs).style(style) else:
# calyx, relic
# 3 (relic)
return [
put_text(value).style("--dashboard-value--"),
put_text(f" ({key})").style("--dashboard-time--"),
]
def put_arg_stored(kwargs: T_Output_Kwargs) -> Output: def put_arg_stored(kwargs: T_Output_Kwargs) -> Output:
@ -337,31 +343,31 @@ def put_arg_stored(kwargs: T_Output_Kwargs) -> Output:
kwargs["disabled"] = True kwargs["disabled"] = True
values = kwargs.pop("value", {}) values = kwargs.pop("value", {})
value = values.pop("value", "")
total = values.pop("total", "")
time_ = values.pop("time", "") time_ = values.pop("time", "")
if "value" in values and "total" in values: if value != "" and total != "":
# display as counter style rows = [put_scope(f"dashboard-value-{name}", [
counter = f'{values["value"]} / {values["total"]}' put_text(value).style("--dashboard-value--"),
rows = [product_stored_row( put_text(f" / {total}").style("--dashboard-time--"),
kwargs, "counter", counter)] ])]
if time_: elif value != "":
rows += [product_stored_row(kwargs, "time", time_)] rows = [put_scope(f"dashboard-value-{name}", [
return put_scope( put_text(value).style("--dashboard-value--")
f"arg_container-stored-{name}", ])]
[
get_title_help(kwargs),
put_scope(
f"arg_stored-stored-value-{name}",
rows,
)
]
)
else: else:
# display per key rows = []
rows = [product_stored_row(kwargs, key, value) if values:
for key, value in values.items() if value] rows += [
put_scope(f"dashboard-value-{name}-{key}", product_stored_row(key, value))
for key, value in values.items() if value != ""
]
if time_: if time_:
rows += [product_stored_row(kwargs, "time", time_)] rows.append(
put_text(time_).style("--dashboard-time--")
)
return put_scope( return put_scope(
f"arg_container-stored-{name}", f"arg_container-stored-{name}",