-
Notifications
You must be signed in to change notification settings - Fork 449
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: mobile login modal (Closes #41)
- Loading branch information
Kerwin
committed
Apr 18, 2023
1 parent
807d400
commit 14c323c
Showing
16 changed files
with
197 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
<script lang="ts" setup> | ||
import { computed, ref } from 'vue' | ||
import { NButton, NInput, NModal, NSpace, useMessage } from 'naive-ui' | ||
import { t } from '@/locales' | ||
import { fetchUpdateChatRoomPrompt } from '@/api' | ||
import { useChatStore } from '@/store' | ||
const props = defineProps<Props>() | ||
const emit = defineEmits<Emit>() | ||
const chatStore = useChatStore() | ||
const currentChatHistory = computed(() => chatStore.getChatHistoryByCurrentActive) | ||
const ms = useMessage() | ||
const testing = ref(false) | ||
const title = `Prompt For [${currentChatHistory.value?.title}]` | ||
interface Props { | ||
visible: boolean | ||
roomId: string | ||
} | ||
interface Emit { | ||
(e: 'update:visible', visible: boolean): void | ||
} | ||
const show = computed({ | ||
get() { | ||
return props.visible | ||
}, | ||
set(visible: boolean) { | ||
emit('update:visible', visible) | ||
}, | ||
}) | ||
async function handleSaveChatRoomPrompt() { | ||
if (!currentChatHistory.value || !currentChatHistory.value) | ||
return | ||
testing.value = true | ||
try { | ||
const { message } = await fetchUpdateChatRoomPrompt(currentChatHistory.value.prompt ?? '', +props.roomId) as { status: string; message: string } | ||
ms.success(message) | ||
show.value = false | ||
} | ||
catch (error: any) { | ||
ms.error(error.message) | ||
} | ||
testing.value = false | ||
} | ||
</script> | ||
|
||
<template> | ||
<NModal | ||
v-model:show="show" :auto-focus="false" class="custom-card" preset="card" :style="{ width: '600px' }" :title="title" size="huge" | ||
:bordered="false" | ||
> | ||
<!-- <template #header-extra> | ||
噢! | ||
</template> --> | ||
<NInput | ||
:value="currentChatHistory && currentChatHistory.prompt" | ||
type="textarea" | ||
:autosize="{ minRows: 4, maxRows: 10 }" placeholder="Prompt for this room, If empty will use Settings -> Advanced -> Role" @input="(val) => { if (currentChatHistory) currentChatHistory.prompt = val }" | ||
/> | ||
<template #footer> | ||
<NSpace justify="end"> | ||
<NButton :loading="testing" type="success" @click="handleSaveChatRoomPrompt"> | ||
{{ t('common.save') }} | ||
</NButton> | ||
</NSpace> | ||
</template> | ||
</NModal> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<template> | ||
<div class="text-[#142D6E] dark:text-[#3a71ff]"> | ||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 24 24"> | ||
<g fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"> | ||
<path d="M5 7l5 5l-5 5" /> | ||
<path d="M13 17h6" /> | ||
</g> | ||
</svg> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.