-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAdminSupportBanner.vue
More file actions
143 lines (121 loc) · 3.32 KB
/
AdminSupportBanner.vue
File metadata and controls
143 lines (121 loc) · 3.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<!--
SPDX-FileCopyrightText: 2026 LibreCode coop and LibreCode contributors
SPDX-License-Identifier: AGPL-3.0-or-later
-->
<template>
<NcNoteCard v-if="isVisible" type="info" data-testid="profile-fields-admin-support-banner">
<div class="profile-fields-admin-support-banner">
<div class="profile-fields-admin-support-banner__copy">
<p><strong>{{ t('profile_fields', 'Help keep Profile Fields sustainable.') }}</strong></p>
<p>{{ t('profile_fields', 'Profile Fields is open source under the AGPL license and maintained by the LibreCode team, creators of LibreSign.') }}</p>
<p>{{ t('profile_fields', 'If your organization depends on it, please help us sustain its development and maintenance.') }}</p>
<div class="profile-fields-admin-support-banner__actions">
<NcButton class="profile-fields-admin-support-banner__action" variant="primary" @click="openSponsorPage">
{{ t('profile_fields', 'Sponsor LibreSign') }}
</NcButton>
<NcButton class="profile-fields-admin-support-banner__dismiss" variant="tertiary-no-background" @click="dismissBanner">
{{ t('profile_fields', 'Maybe later') }}
</NcButton>
</div>
<div class="profile-fields-admin-support-banner__links">
<a href="https://github.com/LibreCodeCoop/profile_fields" target="_blank" rel="noopener noreferrer nofollow">
{{ t('profile_fields', 'Give Profile Fields a {star} on GitHub', {star: '⭐'}) }}
</a>
<a href="mailto:contact@librecode.coop">{{ t('profile_fields', 'Contact us for support or custom development') }}</a>
</div>
</div>
</div>
</NcNoteCard>
</template>
<script setup lang="ts">
import { onMounted, ref } from 'vue'
import { t } from '@nextcloud/l10n'
import { NcButton, NcNoteCard } from '@nextcloud/vue'
const props = withDefaults(defineProps<{
storageKey?: string,
sponsorUrl?: string,
}>(), {
storageKey: 'profile_fields_support_banner_dismissed',
sponsorUrl: 'https://github.com/sponsors/LibreCodeCoop',
})
const isVisible = ref(true)
const dismissBanner = () => {
isVisible.value = false
try {
window.localStorage.setItem(props.storageKey, '1')
} catch {
// Ignore storage errors and keep only in-memory dismissal.
}
}
const openSponsorPage = () => {
window.open(props.sponsorUrl, '_blank', 'noopener,noreferrer')
}
onMounted(() => {
try {
isVisible.value = window.localStorage.getItem(props.storageKey) !== '1'
} catch {
isVisible.value = true
}
})
</script>
<style scoped lang="scss">
.profile-fields-admin-support-banner {
display: grid;
grid-template-columns: minmax(0, 1fr);
gap: 12px;
width: 100%;
&__copy {
display: grid;
gap: 8px;
max-width: 72ch;
p {
margin: 0;
overflow-wrap: anywhere;
line-height: 1.5;
}
a {
overflow-wrap: anywhere;
}
}
&__actions {
display: flex;
flex-wrap: wrap;
align-items: flex-start;
gap: 8px 10px;
padding-top: 2px;
}
&__action,
&__dismiss {
flex: 0 0 auto;
white-space: nowrap;
}
&__dismiss {
:deep(.button-vue) {
padding-inline: 4px;
min-height: auto;
}
}
&__links {
margin: 0;
display: flex;
flex-wrap: wrap;
align-items: center;
gap: 6px 12px;
line-height: 1.5;
a {
font-weight: 600;
}
}
}
@media (max-width: 1024px) {
.profile-fields-admin-support-banner {
gap: 8px;
:deep(.button-vue) {
max-width: 100%;
}
&__links {
gap: 4px;
}
}
}
</style>