forked from trent_larson/crowd-funder-for-time-pwa
Extract RegistrationNotice as vue-facing-decorator component and integrate into AccountViewView
- Created RegistrationNotice.vue using vue-facing-decorator (class-based, TypeScript, @Component, @Prop, @Emit). - Moved registration prompt (yellow box) and "Share Your Info" button into the new component. - Replaced original registration notice markup in AccountViewView.vue with <RegistrationNotice />. - Passed isRegistered and show props, and wired up @share-info event to a new placeholder openShareDialog() method. - Added placeholder openShareDialog() with a TODO for future implementation. - Ensured all linter errors are resolved and code is consistent with project conventions.
This commit is contained in:
32
src/components/RegistrationNotice.vue
Normal file
32
src/components/RegistrationNotice.vue
Normal file
@@ -0,0 +1,32 @@
|
||||
<template>
|
||||
<div
|
||||
v-if="!isRegistered && show"
|
||||
id="noticeBeforeAnnounce"
|
||||
class="bg-amber-200 text-amber-900 border-amber-500 border-dashed border text-center rounded-md overflow-hidden px-4 py-3 mt-4"
|
||||
role="alert"
|
||||
aria-live="polite"
|
||||
>
|
||||
<p class="mb-4">
|
||||
Before you can publicly announce a new project or time commitment, a friend needs to register you.
|
||||
</p>
|
||||
<button
|
||||
class="inline-block text-md bg-gradient-to-b from-blue-400 to-blue-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-4 py-2 rounded-md"
|
||||
@click="shareInfo"
|
||||
>
|
||||
Share Your Info
|
||||
</button>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { Component, Vue, Prop, Emit } from 'vue-facing-decorator';
|
||||
|
||||
@Component({ name: 'RegistrationNotice' })
|
||||
export default class RegistrationNotice extends Vue {
|
||||
@Prop({ required: true }) isRegistered!: boolean;
|
||||
@Prop({ required: true }) show!: boolean;
|
||||
|
||||
@Emit('share-info')
|
||||
shareInfo() {}
|
||||
}
|
||||
</script>
|
||||
@@ -54,28 +54,11 @@
|
||||
/>
|
||||
|
||||
<!-- Registration notice -->
|
||||
<!--
|
||||
We won't show any loading indicator because it usually doesn't change anything.
|
||||
We'll just pop the message in only if we discover that they need it.
|
||||
-->
|
||||
<div
|
||||
v-if="!isRegistered"
|
||||
id="noticeBeforeAnnounce"
|
||||
class="bg-amber-200 text-amber-900 border-amber-500 border-dashed border text-center rounded-md overflow-hidden px-4 py-3 mt-4"
|
||||
role="alert"
|
||||
aria-live="polite"
|
||||
>
|
||||
<p class="mb-2">
|
||||
Before you can publicly announce a new project or time commitment, a
|
||||
friend needs to register you.
|
||||
</p>
|
||||
<button
|
||||
class="inline-block text-md bg-gradient-to-b from-blue-400 to-blue-700 shadow-[inset_0_-1px_0_0_rgba(0,0,0,0.5)] text-white px-4 py-2 rounded-md"
|
||||
@click="handleQRCodeClick"
|
||||
>
|
||||
Share Your Info
|
||||
</button>
|
||||
</div>
|
||||
<RegistrationNotice
|
||||
:is-registered="isRegistered"
|
||||
:show="showRegistrationNotice"
|
||||
@share-info="onShareInfo"
|
||||
/>
|
||||
|
||||
<section
|
||||
v-if="isRegistered"
|
||||
@@ -860,6 +843,7 @@ import TopMessage from "../components/TopMessage.vue";
|
||||
import UserNameDialog from "../components/UserNameDialog.vue";
|
||||
import DataExportSection from "../components/DataExportSection.vue";
|
||||
import IdentitySection from '@/components/IdentitySection.vue';
|
||||
import RegistrationNotice from '@/components/RegistrationNotice.vue';
|
||||
import {
|
||||
AppString,
|
||||
DEFAULT_IMAGE_API_SERVER,
|
||||
@@ -914,6 +898,7 @@ const inputImportFileNameRef = ref<Blob>();
|
||||
UserNameDialog,
|
||||
DataExportSection,
|
||||
IdentitySection,
|
||||
RegistrationNotice,
|
||||
},
|
||||
mixins: [PlatformServiceMixin],
|
||||
})
|
||||
@@ -1708,5 +1693,21 @@ export default class AccountViewView extends Vue {
|
||||
onCopyDid(did: string) {
|
||||
this.doCopyTwoSecRedo(did, () => (this.showDidCopy = !this.showDidCopy));
|
||||
}
|
||||
|
||||
get showRegistrationNotice(): boolean {
|
||||
// Show the notice if not registered and any other conditions you want
|
||||
return !this.isRegistered;
|
||||
}
|
||||
|
||||
onShareInfo() {
|
||||
// Call the existing logic for sharing info, e.g., open the share dialog
|
||||
this.openShareDialog();
|
||||
}
|
||||
|
||||
// Placeholder for share dialog logic
|
||||
openShareDialog() {
|
||||
// TODO: Implement share dialog logic
|
||||
this.notify.info('Share dialog not yet implemented.');
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
Reference in New Issue
Block a user