Add more changes

This commit is contained in:
Muhsin Keloth
2023-07-05 15:19:20 +05:30
parent 464e0a5d35
commit d61eed7169
3 changed files with 110 additions and 99 deletions

View File

@@ -80,13 +80,19 @@
:show.sync="showAIAssistanceModal" :show.sync="showAIAssistanceModal"
:on-close="hideAIAssistanceModal" :on-close="hideAIAssistanceModal"
> >
<AIAssistanceModal @close="hideAIAssistanceModal" /> <AIAssistanceModal
@apply-text="insertText"
@close="hideAIAssistanceModal"
/>
</woot-modal> </woot-modal>
<woot-modal <woot-modal
:show.sync="showAIAssistanceReply" :show.sync="showAIAssistanceReply"
:on-close="hideAIAssistanceReplyModal" :on-close="hideAIAssistanceReplyModal"
> >
<AIAssistanceReply @close="hideAIAssistanceReplyModal" /> <AIAssistanceReply
@apply-text="insertText"
@close="hideAIAssistanceReplyModal"
/>
</woot-modal> </woot-modal>
</div> </div>
</template> </template>
@@ -184,8 +190,8 @@ export default {
ninja.open({ parent: 'ai_assist' }); ninja.open({ parent: 'ai_assist' });
}, },
onAIAssist() { onAIAssist() {
this.showAIAssistanceModal = true; // this.showAIAssistanceModal = true;
// this.showAIAssistanceReply = true; this.showAIAssistanceReply = true;
}, },
toggleDropdown() { toggleDropdown() {
this.showDropdown = !this.showDropdown; this.showDropdown = !this.showDropdown;
@@ -202,6 +208,11 @@ export default {
}); });
} }
}, },
insertText(message) {
console.log('message', message);
this.$emit('replace-text', message);
},
async processEvent(type = 'rephrase') { async processEvent(type = 'rephrase') {
this.uiFlags[type] = true; this.uiFlags[type] = true;
try { try {

View File

@@ -16,22 +16,15 @@
AI generated content AI generated content
</h4> </h4>
</div> </div>
<!-- <TypingIndicator /> --> <div class="animation-container margin-top-1">
<div class="animation-container"> <div class="ai-typing--wrap ">
<label>AI is typing</label> <span class="loader" /> <fluent-icon icon="wand" size="14" class="ai-typing--icon" />
<label>AI is writing</label>
</div>
<span class="loader" />
<span class="loader" />
<span class="loader" />
</div> </div>
<!-- <div class="loading loading04">
<label>AI is typing</label>
<span>.</span>
<span>.</span>
<span>.</span>
</div> -->
<!-- <div v-else>
<p>
{{ aiContent }}
</p>
</div> -->
<div class="modal-footer justify-content-end w-full"> <div class="modal-footer justify-content-end w-full">
<!-- <woot-button <!-- <woot-button
@@ -61,12 +54,7 @@
</template> </template>
<script> <script>
import TypingIndicator from './TypingIndicator.vue';
export default { export default {
components: {
TypingIndicator,
},
data() { data() {
return { return {
draftContent: draftContent:
@@ -109,71 +97,56 @@ export default {
width: 100%; width: 100%;
} }
.animation-container { .ai-typing--wrap {
width: 100%;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: flex-start; gap: 4px;
label {
width: 8rem; .ai-typing--icon {
color: var(--v-500);
} }
} }
.loader {
width: 8px; .animation-container {
height: 8px;
border-radius: 50%;
display: block;
position: relative; position: relative;
color: #000; display: flex;
box-sizing: border-box;
animation: animloader 2s linear infinite;
} }
@keyframes animloader { .animation-container label {
0% {
box-shadow: 14px 0 0 -2px, 38px 0 0 -2px, -14px 0 0 -2px, -38px 0 0 -2px;
}
25% {
box-shadow: 14px 0 0 -2px, 38px 0 0 -2px, -14px 0 0 -2px, -38px 0 0 2px;
}
50% {
box-shadow: 14px 0 0 -2px, 38px 0 0 -2px, -14px 0 0 2px, -38px 0 0 -2px;
}
75% {
box-shadow: 14px 0 0 2px, 38px 0 0 -2px, -14px 0 0 -2px, -38px 0 0 -2px;
}
100% {
box-shadow: 14px 0 0 -2px, 38px 0 0 2px, -14px 0 0 -2px, -38px 0 0 -2px;
}
}
.loading {
font-weight: 800;
text-align: center;
border-radius: 50%;
span {
display: inline-block; display: inline-block;
margin: 0 -0.05em; margin-right: 8px;
} color: var(--v-400);
} }
.loading04 { .loader {
span { display: inline-block;
animation: loading04 0.7s infinite; width: 6px;
@for $i from 1 through 6 { height: 6px;
&:nth-child(#{$i + 1}) { margin-right: 4px;
animation-delay: #{$i * 0.1}s; margin-top: 12px;
background-color: var(--v-300);
border-radius: 50%;
animation: bubble-scale 1.2s infinite;
} }
.loader:nth-child(2) {
animation-delay: 0.4s;
} }
.loader:nth-child(3) {
animation-delay: 0.8s;
} }
}
@keyframes loading04 { @keyframes bubble-scale {
0%, 0%,
100% { 100% {
transform: translateY(0); transform: scale(1);
}
25% {
transform: scale(1.3);
} }
50% { 50% {
transform: translateY(15px); transform: scale(1);
} }
} }
</style> </style>

View File

@@ -2,7 +2,13 @@
<div class="column"> <div class="column">
<woot-modal-header header-title="Reply suggestion with AI" /> <woot-modal-header header-title="Reply suggestion with AI" />
<form class="row modal-content" @submit.prevent="chooseTime"> <form class="row modal-content" @submit.prevent="chooseTime">
<div v-if="!generatedContent" class="animation-container"> <div v-if="!generatedContent" class="animation-container margin-top-1">
<div class="ai-typing--wrap ">
<fluent-icon icon="wand" size="14" class="ai-typing--icon" />
<label>AI is writing</label>
</div>
<span class="loader" />
<span class="loader" />
<span class="loader" /> <span class="loader" />
</div> </div>
@@ -31,7 +37,7 @@
:disabled="!enableButtons" :disabled="!enableButtons"
>Retry >Retry
</woot-button> --> </woot-button> -->
<woot-button :disabled="!enableButtons"> <woot-button :disabled="!enableButtons" @click="applyContent">
Apply Apply
</woot-button> </woot-button>
</div> </div>
@@ -70,6 +76,10 @@ export default {
this.$emit('close'); this.$emit('close');
}, },
chooseTime() {}, chooseTime() {},
applyContent() {
this.$emit('apply-text', this.generatedContent);
this.$emit('close');
},
}, },
}; };
</script> </script>
@@ -83,39 +93,56 @@ export default {
width: 100%; width: 100%;
} }
.animation-container { .ai-typing--wrap {
width: 100%;
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: center; gap: 4px;
.ai-typing--icon {
color: var(--v-500);
} }
.loader {
width: 12px;
height: 12px;
border-radius: 50%;
display: block;
margin-top: 2rem;
position: relative;
color: #000;
box-sizing: border-box;
animation: animloader 2s linear infinite;
} }
@keyframes animloader { .animation-container {
0% { position: relative;
box-shadow: 14px 0 0 -2px, 38px 0 0 -2px, -14px 0 0 -2px, -38px 0 0 -2px; display: flex;
}
.animation-container label {
display: inline-block;
margin-right: 8px;
color: var(--v-400);
}
.loader {
display: inline-block;
width: 6px;
height: 6px;
margin-right: 4px;
margin-top: 12px;
background-color: var(--v-300);
border-radius: 50%;
animation: bubble-scale 1.2s infinite;
}
.loader:nth-child(2) {
animation-delay: 0.4s;
}
.loader:nth-child(3) {
animation-delay: 0.8s;
}
@keyframes bubble-scale {
0%,
100% {
transform: scale(1);
} }
25% { 25% {
box-shadow: 14px 0 0 -2px, 38px 0 0 -2px, -14px 0 0 -2px, -38px 0 0 2px; transform: scale(1.3);
} }
50% { 50% {
box-shadow: 14px 0 0 -2px, 38px 0 0 -2px, -14px 0 0 2px, -38px 0 0 -2px; transform: scale(1);
}
75% {
box-shadow: 14px 0 0 2px, 38px 0 0 -2px, -14px 0 0 -2px, -38px 0 0 -2px;
}
100% {
box-shadow: 14px 0 0 -2px, 38px 0 0 2px, -14px 0 0 -2px, -38px 0 0 -2px;
} }
} }