Skip to content

Commit

Permalink
feat: add documentation settings (#1958)
Browse files Browse the repository at this point in the history
* feat: add documentation settings

* fix: hide socialChat button when no link
  • Loading branch information
pugakn authored Jan 26, 2023
1 parent 9c981ae commit 4f38495
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 4 deletions.
34 changes: 34 additions & 0 deletions src/components/dao/settings-general.vue
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,40 @@ widget(title='General' titleImage='/svg/file-checkmark.svg' :bar='true').q-pa-no
v-model='form.socialChat'
)
q-tooltip(:content-style="{ 'font-size': '1em' }" anchor="top middle" self="bottom middle" v-if="!isAdmin") Only DAO admins can change the settings
.col-3.q-pl-sm
.row.items-center.q-col-gutter-xs
label.h-label Link to documentation
q-input.q-my-sm(
:debounce="200"
:disable="!isAdmin"
bg-color="white"
color="accent"
dense
lazy-rules
outlined
placeholder="Paste the URL address here"
ref="name"
rounded
v-model='form.documentationURL'
)
q-tooltip(:content-style="{ 'font-size': '1em' }" anchor="top middle" self="bottom middle" v-if="!isAdmin") Only DAO admins can change the settings
.col-3.q-pl-sm
.row.items-center.q-col-gutter-xs
label.h-label Button text
q-input.q-my-sm(
:debounce="200"
:disable="!isAdmin"
bg-color="white"
color="accent"
dense
lazy-rules
outlined
placeholder="Documentation"
ref="name"
rounded
v-model='form.documentationButtonText'
)
q-tooltip(:content-style="{ 'font-size': '1em' }" anchor="top middle" self="bottom middle" v-if="!isAdmin") Only DAO admins can change the settings

.row.justify-between.q-mt-xl
.col-6.q-pr-sm
Expand Down
3 changes: 2 additions & 1 deletion src/components/dashboard/support-widget.vue
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export default {
props: {
documentationURL: String,
documentationButtonText: String,
socialChat: String
},
Expand All @@ -27,7 +28,7 @@ widget(title="Need support?")
.h-b2.q-mt-md Please read our Documentation for more info. If you are stuck with a problem you can also reach out to us on discord in the "dao-support" channel.
.row.justify-between.flex.items-center.q-mb-sm
.col-auto
q-btn.q-mt-md.q-px-sm.text-white(noCaps rounded color="primary" @click="openLink(documentationURL || 'https://help.hypha.earth/hc/2431449449')") Documentation
q-btn.q-mt-md.q-px-sm.text-white(noCaps rounded color="primary" @click="openLink(documentationURL || 'https://help.hypha.earth/hc/2431449449')") {{ documentationButtonText || 'Documentation' }}
.col(v-if="socialChat")
q-btn.q-mt-md.q-ml-sm.discord-buttom(unelevated rounded color="primary" icon="fab fa-discord" size="0.7rem" @click="openLink(socialChat)")
</template>
Expand Down
4 changes: 4 additions & 0 deletions src/pages/dho/Configuration.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ const defaultSettings = {
membersApplicationEnabled: true,
removableBannersEnabled: true,
socialChat: '',
documentationButtonText: '',
documentationURL: '',
// VOTING FORM
votingDurationSec: '',
Expand Down Expand Up @@ -105,6 +107,8 @@ export default {
membersApplicationEnabled: this.daoSettings?.membersApplicationEnabled !== null ? this.daoSettings?.membersApplicationEnabled : defaultSettings.membersApplicationEnabled,
removableBannersEnabled: this.daoSettings?.removableBannersEnabled !== null ? this.daoSettings?.removableBannersEnabled : defaultSettings.removableBannersEnabled,
socialChat: this.daoSettings?.socialChat ? this.daoSettings?.socialChat : defaultSettings.socialChat,
documentationURL: this.daoSettings?.documentationURL ? this.daoSettings?.documentationURL : defaultSettings.documentationURL,
documentationButtonText: this.daoSettings?.documentationButtonText ? this.daoSettings?.documentationButtonText : defaultSettings.documentationButtonText,
votingDurationSec: this.daoSettings?.votingDurationSec ? this.daoSettings?.votingDurationSec : defaultSettings.votingDurationSec,
// periodDurationSec: this.daoSettings?.periodDurationSec ? this.daoSettings?.periodDurationSec : defaultSettings.periodDurationSec,
Expand Down
6 changes: 3 additions & 3 deletions src/pages/dho/Home.vue
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ q-page.page-home
metric-link.col(:amount="activeMembersCount" title="Active members" link="members")
.row.full-width.q-gutter-x-md
how-it-works.col
support-widget.col(:documentationURL="daoSettings.documentationURL" :socialChat="daoSettings.socialChat")
support-widget.col(:documentationURL="daoSettings.documentationURL" :socialChat="daoSettings.socialChat" :documentationButtonText="daoSettings.documentationButtonText")
.col-3.q-ml-md
new-members(:members="newMembers")

Expand All @@ -239,7 +239,7 @@ q-page.page-home
.row.q-gutter-y-md.q-ml-xs
metric-link(:amount="activeProposalsCount" link="proposals" title="New Proposals" ).full-height.full-width
metric-link(:amount="activeMembersCount" link="members" title="Active Members").full-height.full-width
support-widget(:documentationURL="daoSettings.documentationURL" :socialChat="daoSettings.socialChat").full-height.full-width
support-widget(:documentationURL="daoSettings.documentationURL" :socialChat="daoSettings.socialChat" :documentationButtonText="daoSettings.documentationButtonText").full-height.full-width
.col-12.q-mt-md
how-it-works.full-height

Expand All @@ -259,7 +259,7 @@ q-page.page-home
.row.q-mt-md
how-it-works.full-width
.row.q-mt-md
support-widget.full-width(:documentationURL="daoSettings.documentationURL" :socialChat="daoSettings.socialChat")
support-widget.full-width(:documentationURL="daoSettings.documentationURL" :socialChat="daoSettings.socialChat" :documentationButtonText="daoSettings.documentationButtonText")
</template>

<style lang="stylus" scoped>
Expand Down
1 change: 1 addition & 0 deletions src/query/dao-active.gql
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ query activeDao($regexp: String!) {
settings_voiceToken_a

settings_socialChat_s
settings_documentationButtonText_s

settings_proposalsCreationEnabled_i
settings_membersApplicationEnabled_i
Expand Down
1 change: 1 addition & 0 deletions src/store/dao/mutations.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export const switchDao = (state, daos) => {
voiceTokenDecimals: settings?.settings_voiceToken_a.split(' ')[0].split('.')[1].length,

documentationURL: settings?.settings_documentationURL_s,
documentationButtonText: settings?.settings_documentationButtonText_s,

socialChat: settings?.settings_socialChat_s,
url: settings.settings_daoUrl_s,
Expand Down

0 comments on commit 4f38495

Please sign in to comment.