Skip to content

Commit d413842

Browse files
committed
fix(pat contentbrowser): do not shrink preview and upload column width. Add more metadata to preview item.
1 parent 5efb7a2 commit d413842

File tree

3 files changed

+58
-11
lines changed

3 files changed

+58
-11
lines changed

src/pat/contentbrowser/contentbrowser.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ parser.addArgument(
2121
"getIcon",
2222
"is_folderish",
2323
"review_state",
24+
"created",
25+
"modified",
2426
], null, true
2527
);
2628
parser.addArgument("width");

src/pat/contentbrowser/src/ContentBrowser.svelte

Lines changed: 48 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import contentStore from "./ContentStore";
99
import {
1010
clickOutside,
11+
formatDate,
1112
get_items_from_uids,
1213
request,
1314
resolveIcon,
@@ -67,6 +68,7 @@
6768
6869
async function upload() {
6970
updatePreview({ action: "clear" });
71+
scrollToRight();
7072
showUpload = true;
7173
await utils.timeout(1);
7274
const uploadEl = document.querySelector(".upload-wrapper");
@@ -182,7 +184,10 @@
182184
...document.querySelectorAll(".levelColumn .inPath"), // previously selected folder
183185
...document.querySelectorAll(".levelColumn .selectedItem"), // previously selected item
184186
];
185-
if(!possibleFocusEls.length && document.querySelector(".levelColumn .contentItem")) {
187+
if (
188+
!possibleFocusEls.length &&
189+
document.querySelector(".levelColumn .contentItem")
190+
) {
186191
possibleFocusEls.push(document.querySelector(".levelColumn .contentItem"));
187192
}
188193
if (possibleFocusEls.length) {
@@ -426,7 +431,7 @@
426431
{#if level.selectable}
427432
<button
428433
class="btn btn-primary btn-xs"
429-
title="{level.displayPath}"
434+
title={level.displayPath}
430435
disabled={!isSelectable(level)}
431436
on:click|preventDefault={() => addItem(level)}
432437
>
@@ -505,7 +510,9 @@
505510
/>
506511
{item.Title}
507512
{#if $config.mode == "search"}
508-
<br><span class="small">{item.path}</span>
513+
<br /><span class="small"
514+
>{item.path}</span
515+
>
509516
{/if}
510517
</div>
511518
{/if}
@@ -568,8 +575,39 @@
568575
/>
569576
</div>
570577
{/if}
571-
<h4>{previewItem.Title}</h4>
572-
<p>{previewItem.Description}</p>
578+
<dl>
579+
<dt>{_t("Title")}</dt>
580+
<dd>{previewItem.Title}</dd>
581+
{#if previewItem.Description}
582+
<dt>{_t("Description")}</dt>
583+
<dd
584+
class="text-truncate"
585+
title={previewItem.Description}
586+
>
587+
{previewItem.Description}
588+
</dd>
589+
{/if}
590+
{#if previewItem.created}
591+
<dt>{_t("created")}</dt>
592+
<dd>
593+
<time datetime={previewItem.created}
594+
>{formatDate(previewItem.created)}</time
595+
>
596+
</dd>
597+
{/if}
598+
{#if previewItem.modified}
599+
<dt>{_t("modified")}</dt>
600+
<dd>
601+
<time datetime={previewItem.modified}
602+
>{formatDate(previewItem.modified)}</time
603+
>
604+
</dd>
605+
{/if}
606+
{#if previewItem.review_state}
607+
<dt>{_t("review_state")}</dt>
608+
<dd>{previewItem.review_state}</dd>
609+
{/if}
610+
</dl>
573611
</div>
574612
</div>
575613
{/if}
@@ -672,7 +710,7 @@
672710
.levelToolbar > .levelActions {
673711
margin-left: auto;
674712
}
675-
.levelToolbar > button{
713+
.levelToolbar > button {
676714
white-space: nowrap;
677715
overflow: hidden;
678716
text-overflow: ellipsis;
@@ -693,7 +731,7 @@
693731
outline: none;
694732
}
695733
.contentItem.even {
696-
background-color: rgba(var(--bs-secondary-bg-rgb), .4);
734+
background-color: rgba(var(--bs-secondary-bg-rgb), 0.4);
697735
}
698736
.contentItem.inPath,
699737
.contentItem:focus {
@@ -726,6 +764,7 @@
726764
min-height: 300px;
727765
display: flex;
728766
flex-direction: column;
767+
flex-shrink: 0;
729768
align-items: center;
730769
}
731770
.preview .info {
@@ -740,9 +779,6 @@
740779
width: 50px !important;
741780
height: 50px !important;
742781
}
743-
.preview h4 {
744-
font-size: 1.2 rem;
745-
}
746782
.preview img {
747783
max-width: 100%;
748784
max-width: 100%;
@@ -751,8 +787,9 @@
751787
752788
.upload-wrapper {
753789
padding: 1rem;
754-
width: 590px;
790+
width: 540px;
755791
overflow-x: auto;
792+
flex-shrink: 0;
756793
}
757794
.loadmore {
758795
text-align: center;

src/pat/contentbrowser/src/utils.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import utils from "../../../core/utils.js";
2+
import I18n from "../../../core/i18n.js";
23

34
export async function request({
45
method = "GET",
@@ -212,3 +213,10 @@ export function updateRecentlyUsed(item, config) {
212213
recentlyUsed.push(item);
213214
utils.storage.set(config.recentlyUsedKey, recentlyUsed);
214215
}
216+
217+
218+
export function formatDate(dateval) {
219+
const d = Date.parse(dateval);
220+
const i18n = new I18n();
221+
return new Date(d).toLocaleString(i18n.currentLanguage);
222+
}

0 commit comments

Comments
 (0)