diff options
-rw-r--r-- | .reuse/dep5 | 2 | ||||
-rw-r--r-- | apps/federatedfilesharing/src/components/PersonalSettings.vue | 70 | ||||
-rw-r--r-- | core/img/facebook.svg | 2 | ||||
-rw-r--r-- | core/img/mastodon.svg | 2 | ||||
-rw-r--r-- | core/img/x.svg | 1 |
5 files changed, 48 insertions, 29 deletions
diff --git a/.reuse/dep5 b/.reuse/dep5 index 80b9ea8097f..b85eb822707 100644 --- a/.reuse/dep5 +++ b/.reuse/dep5 @@ -203,7 +203,7 @@ Files: core/img/apps/richdocumentscode.svg Copyright: 2016-2024 Collabora Ltd. License: LicenseRef-CollaboraTrademarks -Files: core/img/twitter.svg core/img/actions/twitter.svg apps/federatedfilesharing/img/social-twitter.svg +Files: core/img/x.svg core/img/twitter.svg core/img/actions/twitter.svg apps/federatedfilesharing/img/social-twitter.svg Copyright: X Corp. License: LicenseRef-XTrademarks diff --git a/apps/federatedfilesharing/src/components/PersonalSettings.vue b/apps/federatedfilesharing/src/components/PersonalSettings.vue index bf1d2192816..38061dc022c 100644 --- a/apps/federatedfilesharing/src/components/PersonalSettings.vue +++ b/apps/federatedfilesharing/src/components/PersonalSettings.vue @@ -13,7 +13,7 @@ :title="copyLinkTooltip" :aria-label="copyLinkTooltip" class="clipboard" - type="tertiary-no-background" + type="tertiary" @click.prevent="copyCloudId"> <template #icon> <Clipboard :size="20" /> @@ -26,22 +26,20 @@ <NcButton @click="goTo(shareFacebookUrl)"> {{ t('federatedfilesharing', 'Facebook') }} <template #icon> - <Facebook :size="20" /> + <img class="social-button__icon social-button__icon--bright" :src="urlFacebookIcon"> </template> </NcButton> - <NcButton @click="goTo(shareXUrl)"> + <NcButton :aria-label="t('federatedfilesharing', 'X (formerly Twitter)')" + @click="goTo(shareXUrl)"> {{ t('federatedfilesharing', 'formerly Twitter') }} <template #icon> - <svg width="20" - height="20" - viewBox="0 0 15 15" - xmlns="http://www.w3.org/2000/svg"><path fill="black" d="m 3.384891,2.6 c -0.3882,0 -0.61495,0.4362184 -0.39375,0.7558594 L 6.5841098,8.4900156 2.9770785,12.707422 C 2.7436785,12.979821 2.9370285,13.4 3.2958285,13.4 H 3.694266 c 0.176,0 0.3430313,-0.07714 0.4570313,-0.210938 L 7.294266,9.5065156 9.6602817,12.887891 C 9.8762817,13.208984 10.25229,13.4 10.743485,13.4 h 1.900391 c 0.3882,0 0.61575,-0.436688 0.39375,-0.754688 L 9.2466097,7.2195156 12.682547,3.1941408 C 12.881744,2.9601408 12.715528,2.6 12.407473,2.6 h -0.506566 c -0.175,0 -0.34186,0.076453 -0.45586,0.2197656 L 8.5405785,6.2058438 6.3790317,3.1132812 C 6.1568442,2.7913687 5.6965004,2.6 5.3958285,2.6 Z" /></svg> + <img class="social-button__icon" :src="urlXIcon"> </template> </NcButton> <NcButton @click="goTo(shareMastodonUrl)"> {{ t('federatedfilesharing', 'Mastodon') }} <template #icon> - <Mastodon :size="20" /> + <img class="social-button__icon" :src="urlMastodonIcon"> </template> </NcButton> <NcButton class="social-button__website-button" @@ -73,13 +71,13 @@ </NcSettingsSection> </template> -<script> -import { showError, showSuccess } from '@nextcloud/dialogs' +<script lang="ts"> +import { showSuccess } from '@nextcloud/dialogs' import { loadState } from '@nextcloud/initial-state' +import { t } from '@nextcloud/l10n' +import { imagePath } from '@nextcloud/router' import NcSettingsSection from '@nextcloud/vue/dist/Components/NcSettingsSection.js' import NcButton from '@nextcloud/vue/dist/Components/NcButton.js' -import Mastodon from 'vue-material-design-icons/Mastodon.vue' -import Facebook from 'vue-material-design-icons/Facebook.vue' import Web from 'vue-material-design-icons/Web.vue' import Clipboard from 'vue-material-design-icons/ContentCopy.vue' @@ -88,18 +86,25 @@ export default { components: { NcButton, NcSettingsSection, - Mastodon, - Facebook, Web, Clipboard, }, + setup() { + return { + t, + + cloudId: loadState<string>('federatedfilesharing', 'cloudId'), + reference: loadState<string>('federatedfilesharing', 'reference'), + urlFacebookIcon: imagePath('core', 'facebook'), + urlMastodonIcon: imagePath('core', 'mastodon'), + urlXIcon: imagePath('core', 'x'), + } + }, data() { return { color: loadState('federatedfilesharing', 'color'), textColor: loadState('federatedfilesharing', 'textColor'), logoPath: loadState('federatedfilesharing', 'logoPath'), - reference: loadState('federatedfilesharing', 'reference'), - cloudId: loadState('federatedfilesharing', 'cloudId'), docUrlFederated: loadState('federatedfilesharing', 'docUrlFederated'), showHtml: false, isCopied: false, @@ -113,7 +118,7 @@ export default { return t('federatedfilesharing', 'Share with me through my #Nextcloud Federated Cloud ID') }, shareMastodonUrl() { - return `https://https://mastodon.xyz/?text=${encodeURIComponent(this.messageWithoutURL)}&url=${encodeURIComponent(this.reference)}` + return `https://mastodon.social/?text=${encodeURIComponent(this.messageWithoutURL)}&url=${encodeURIComponent(this.reference)}` }, shareXUrl() { return `https://x.com/intent/tweet?text=${encodeURIComponent(this.messageWithURL)}` @@ -141,18 +146,18 @@ export default { }, }, methods: { - async copyCloudId() { - if (!navigator.clipboard) { - // Clipboard API not available - showError(t('federatedfilesharing', 'Clipboard is not available')) - return + async copyCloudId(): Promise<void> { + try { + await navigator.clipboard.writeText(this.cloudId) + showSuccess(t('federatedfilesharing', 'Cloud ID copied to the clipboard')) + } catch (e) { + // no secure context or really old browser - need a fallback + window.prompt(t('federatedfilesharing', 'Clipboard not available. Please copy the cloud ID manually.'), this.reference) } - await navigator.clipboard.writeText(this.cloudId) this.isCopied = true - showSuccess(t('federatedfilesharing', 'Copied!')) - this.$refs.clipboard.$el.focus() }, - goTo(url) { + + goTo(url: string): void { window.location.href = url }, }, @@ -162,14 +167,27 @@ export default { <style lang="scss" scoped> .social-button { margin-top: 0.5rem; + button { display: inline-flex; margin-left: 0.5rem; margin-top: 1rem; } + &__website-button { width: min(100%, 400px) !important; } + + &__icon { + height: 20px; + width: 20px; + filter: var(--background-invert-if-dark); + + &--bright { + // Some logos like the Facebook logo have bright color schema + filter: var(--background-invert-if-bright); + } + } } .cloud-id-text { display: flex; diff --git a/core/img/facebook.svg b/core/img/facebook.svg index 3fa56a73501..bbd719686bb 100644 --- a/core/img/facebook.svg +++ b/core/img/facebook.svg @@ -1 +1 @@ -<svg viewBox="0 0 16 16" height="16" width="16" xmlns="http://www.w3.org/2000/svg" xml:space="preserve" style="fill-rule:evenodd;clip-rule:evenodd;stroke-linejoin:round;stroke-miterlimit:2"><circle cx="8" cy="8" r="8" style="fill:#3a5ba2"/><path d="M0 1.831c0-138.071-111.929-250-250-250s-250 111.929-250 250c0 117.245 80.715 215.622 189.606 242.638V78.227h-51.552V1.831h51.552v-32.919c0-85.092 38.508-124.532 122.048-124.532 15.838 0 43.167 3.105 54.347 6.211v69.254c-5.901-.621-16.149-.932-28.882-.932-40.993 0-56.832 15.528-56.832 55.9V1.831h81.659l-14.028 76.396h-67.631V250C-95.927 235.049 0 129.649 0 1.831" style="fill:#fff;fill-rule:nonzero" transform="matrix(.02 0 0 .02 13 7.963)"/></svg>
\ No newline at end of file +<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20"><defs><clipPath id="a" clipPathUnits="userSpaceOnUse"><path d="M-600 350h700v-700h-700Z"/></clipPath></defs><path d="M0 0c0 138.071-111.929 250-250 250S-500 138.071-500 0c0-117.245 80.715-215.622 189.606-242.638v166.242h-51.552V0h51.552v32.919c0 85.092 38.508 124.532 122.048 124.532 15.838 0 43.167-3.105 54.347-6.211V81.986c-5.901.621-16.149.932-28.882.932-40.993 0-56.832-15.528-56.832-55.9V0h81.659l-14.028-76.396h-67.631v-171.773C-95.927-233.218 0-127.818 0 0" clip-path="url(#a)" style="fill:#fff;fill-opacity:1;fill-rule:nonzero;stroke:none" transform="matrix(.032 0 0 -.032 18 10)"/></svg>
\ No newline at end of file diff --git a/core/img/mastodon.svg b/core/img/mastodon.svg index d7bfdcf8de9..87357d1a6bc 100644 --- a/core/img/mastodon.svg +++ b/core/img/mastodon.svg @@ -1 +1 @@ -<svg width="16" height="16" version="1.1" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><circle cx="8" cy="8" r="8" fill="#2b90d2"/><path d="m13.183 9.2819c-0.1566 0.80567-1.4026 1.6874-2.8336 1.8583-0.74623 0.08903-1.4809 0.17088-2.2644 0.13494-1.2813-0.05872-2.2923-0.30582-2.2923-0.30582 0 0.12473 0.0077 0.24349 0.02307 0.35456 0.16657 1.2645 1.2538 1.3402 2.2837 1.3755 1.0395 0.03557 1.9651-0.25629 1.9651-0.25629l0.0427 0.93975s-0.72709 0.39044-2.0223 0.46224c-0.71423 0.03926-1.6011-0.01798-2.634-0.29136-2.2402-0.59294-2.6255-2.9809-2.6844-5.4039-0.01797-0.7194-0.00687-1.3977-0.00687-1.9651 0-2.4776 1.6233-3.2038 1.6233-3.2038 0.81852-0.37591 2.223-0.53399 3.6832-0.54593h0.035867c1.4601 0.011937 2.8656 0.17002 3.6841 0.54593 0 0 1.6233 0.72623 1.6233 3.2038 0 0 0.02036 1.828-0.22639 3.0971" fill="#fff" stroke-width=".049227"/><path d="m11.494 6.377v3h-1.1885v-2.9118c0-0.6138-0.25826-0.92535-0.77484-0.92535-0.57116 0-0.85742 0.36957-0.85742 1.1004v1.5938h-1.1815v-1.5938c0-0.73078-0.28632-1.1004-0.85748-1.1004-0.51658 0-0.77484 0.31155-0.77484 0.92535v2.9118h-1.1885v-3c0-0.61313 0.15611-1.1004 0.46969-1.4608 0.32336-0.36047 0.74684-0.54525 1.2725-0.54525 0.6082 0 1.0688 0.23377 1.3733 0.70137l0.29604 0.49627 0.2961-0.49627c0.30447-0.4676 0.76505-0.70137 1.3733-0.70137 0.52563 0 0.9491 0.18479 1.2725 0.54525 0.31352 0.36047 0.46963 0.84769 0.46963 1.4608" fill="#2b90d9" stroke-width=".049227"/></svg> +<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20"><path fill="inherit" d="M17.194 5.542c-.235-1.719-1.757-3.074-3.562-3.336C13.328 2.16 12.174 2 9.502 2h-.02c-2.673 0-3.246.161-3.55.206-1.755.255-3.357 1.472-3.746 3.212-.187.857-.207 1.806-.172 2.677.05 1.25.06 2.497.174 3.741.08.827.22 1.647.416 2.454.37 1.49 1.866 2.731 3.331 3.237a9.07 9.07 0 0 0 4.873.253c.178-.04.354-.087.528-.141.392-.123.853-.26 1.191-.502a.038.038 0 0 0 .016-.03v-1.205a.035.035 0 0 0-.014-.027.035.035 0 0 0-.015-.007.038.038 0 0 0-.016 0 13.713 13.713 0 0 1-3.162.364c-1.833 0-2.326-.856-2.467-1.213a3.707 3.707 0 0 1-.214-.955.035.035 0 0 1 .028-.036.037.037 0 0 1 .016 0c1.019.242 2.063.364 3.11.364.253 0 .504 0 .756-.007 1.054-.029 2.164-.082 3.201-.281.026-.005.052-.01.074-.016 1.636-.31 3.192-1.28 3.35-3.736.006-.097.02-1.013.02-1.113.001-.341.112-2.42-.016-3.697zm-2.517 6.13h-1.72V7.527c0-.873-.369-1.318-1.12-1.318-.826 0-1.24.527-1.24 1.567v2.268h-1.71V7.776c0-1.04-.414-1.567-1.24-1.567-.747 0-1.12.445-1.121 1.318v4.145H4.807V7.4c0-.873.227-1.566.68-2.08.467-.513 1.08-.776 1.84-.776.88 0 1.545.333 1.988.999l.428.707.429-.707c.443-.666 1.108-.999 1.987-.999.76 0 1.372.263 1.84.776.454.514.68 1.207.68 2.08z" style="stroke-width:.206161"/></svg>
\ No newline at end of file diff --git a/core/img/x.svg b/core/img/x.svg new file mode 100644 index 00000000000..aa5bfc910a1 --- /dev/null +++ b/core/img/x.svg @@ -0,0 +1 @@ +<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20"><path d="M11.317 8.775 17.146 2h-1.381l-5.061 5.883L6.662 2H2l6.112 8.895L2 18h1.381l5.344-6.212L12.995 18h4.661l-6.339-9.225Zm-1.891 2.199-.62-.886L3.88 3.04H6l3.977 5.688.62.886 5.168 7.394h-2.121l-4.218-6.034Z" style="stroke-width:.0130466"/></svg>
\ No newline at end of file |