From bd779dfc0d68e95bb399d10e5c5cf11c2c97c892 Mon Sep 17 00:00:00 2001 From: Alexander Platov Date: Thu, 16 Sep 2021 10:23:58 +0300 Subject: [PATCH] Fix Link and Attachments. Add FileGroup. Correct hover on Channels. (#194) Signed-off-by: Alexander Platov --- .../src/components/Channels.svelte | 23 ++++- packages/ui/src/components/Link.svelte | 32 ++++++- .../src/components/AttachmentPresenter.svelte | 14 ++-- .../src/components/FileGroup.svelte | 84 +++++++++++++++++++ .../src/components/Attachments.svelte | 6 +- .../src/components/CreateCandidate.svelte | 7 +- 6 files changed, 146 insertions(+), 20 deletions(-) create mode 100644 plugins/chunter-resources/src/components/FileGroup.svelte diff --git a/packages/presentation/src/components/Channels.svelte b/packages/presentation/src/components/Channels.svelte index 108170ff17..b67626061c 100644 --- a/packages/presentation/src/components/Channels.svelte +++ b/packages/presentation/src/components/Channels.svelte @@ -95,7 +95,6 @@ display: flex; flex-direction: row; align-items: center; - &.reverse { flex-direction: row-reverse; } .circle { position: relative; @@ -139,9 +138,16 @@ &::after { position: absolute; top: 0; - left: 0; - right: 0; bottom: -1rem; + left: -100%; + right: -100%; + clip-path: polygon(0 100%, 25% 50%, 25% 0, 75% 0, 75% 50%, 100% 100%); + // background-color: rgba(255, 255, 0, .5); + } + &:first-child:after { + left: 0; + right: -100%; + clip-path: polygon(0 0, 0 100%, 100% 100%, 65% 50%, 65% 0); } } .list-small { @@ -155,13 +161,22 @@ height: 2rem; } + &.reverse { + flex-direction: row-reverse; + .list:first-child:after { + left: -100%; + right: 0; + clip-path: polygon(0 100%, 35% 50%, 35% 0, 100% 0, 100% 100%); + } + } + .window { position: absolute; display: flex; align-items: center; justify-content: space-between; padding: 1rem; - top: 2.25rem; + top: calc(100% + .5rem); min-width: 100%; background-color: var(--theme-button-bg-focused); border: 1px solid var(--theme-button-border-enabled); diff --git a/packages/ui/src/components/Link.svelte b/packages/ui/src/components/Link.svelte index 45d1ac3282..6c90fd61f2 100644 --- a/packages/ui/src/components/Link.svelte +++ b/packages/ui/src/components/Link.svelte @@ -20,9 +20,15 @@ export let label: IntlString export let href: string export let icon: Asset | AnySvelteComponent | undefined + export let disabled: boolean = false + export let maxLenght: number = 26 + + const trimFilename = (fname: string): string => (fname.length > maxLenght) + ? fname.substr(0, (maxLenght - 1) / 2) + '...' + fname.substr(-(maxLenght - 1) / 2) + : fname - + {#if icon} {#if typeof (icon) === 'string'} @@ -32,7 +38,11 @@ {/if} {/if} - {label} + {#if disabled} + {trimFilename(label)} + {:else} + {trimFilename(label)} + {/if} diff --git a/plugins/chunter-resources/src/components/AttachmentPresenter.svelte b/plugins/chunter-resources/src/components/AttachmentPresenter.svelte index b1c188e36d..69d495fb2d 100644 --- a/plugins/chunter-resources/src/components/AttachmentPresenter.svelte +++ b/plugins/chunter-resources/src/components/AttachmentPresenter.svelte @@ -15,13 +15,13 @@ --> @@ -29,6 +29,6 @@ export let value: { attachments: Bag } {#if Object.keys(value.attachments).length === 1} { showPopup(PDFViewer, { file: Object.values(value.attachments)[0].file }, 'right') } }/> {:else if Object.keys(value.attachments).length > 1} - Files + {/if} {/if} diff --git a/plugins/chunter-resources/src/components/FileGroup.svelte b/plugins/chunter-resources/src/components/FileGroup.svelte new file mode 100644 index 0000000000..8ba14352ee --- /dev/null +++ b/plugins/chunter-resources/src/components/FileGroup.svelte @@ -0,0 +1,84 @@ + + + + +
+ + {Object.values(files).length} file(s) +
+ {#each Object.values(files) as file} +
+ { showPopup(PDFViewer, { file: file.file }, 'right') } }/> +
+ {/each} +
+
+ + diff --git a/plugins/recruit-resources/src/components/Attachments.svelte b/plugins/recruit-resources/src/components/Attachments.svelte index cb448ea25b..41bc4585ea 100644 --- a/plugins/recruit-resources/src/components/Attachments.svelte +++ b/plugins/recruit-resources/src/components/Attachments.svelte @@ -65,6 +65,10 @@ if (file !== undefined) { createAttachment(file) } } + const maxLenght: number = 52 + const trimFilename = (fname: string): string => (fname.length > maxLenght) + ? fname.substr(0, (maxLenght - 1) / 2) + '...' + fname.substr(-(maxLenght - 1) / 2) + : fname
@@ -91,7 +95,7 @@
pdf
{ showPopup(PDFViewer, { file: file.file }, 'right') } }> -
{file.name}
+
{trimFilename(file.name)}
{file.type}
diff --git a/plugins/recruit-resources/src/components/CreateCandidate.svelte b/plugins/recruit-resources/src/components/CreateCandidate.svelte index 9f4d6f6881..060778d811 100644 --- a/plugins/recruit-resources/src/components/CreateCandidate.svelte +++ b/plugins/recruit-resources/src/components/CreateCandidate.svelte @@ -161,13 +161,12 @@
{#if resume.uuid} - { showPopup(PDFViewer, { file: resume.uuid }, 'right') } }/> + { showPopup(PDFViewer, { file: resume.uuid }, 'right') } }/> {:else} {#if loading} - Uploading... + {:else} - - { inputFile.click() } }>Upload resume + { inputFile.click() } } /> {/if} {/if}