feat(app): change prompt placeholder based on comment count
This commit is contained in:
@@ -123,6 +123,7 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
|
|||||||
const local = useLocal()
|
const local = useLocal()
|
||||||
const files = useFile()
|
const files = useFile()
|
||||||
const prompt = usePrompt()
|
const prompt = usePrompt()
|
||||||
|
const commentCount = createMemo(() => prompt.context.items().filter((item) => !!item.comment?.trim()).length)
|
||||||
const layout = useLayout()
|
const layout = useLayout()
|
||||||
const comments = useComments()
|
const comments = useComments()
|
||||||
const params = useParams()
|
const params = useParams()
|
||||||
@@ -1827,7 +1828,11 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
|
|||||||
aria-label={
|
aria-label={
|
||||||
store.mode === "shell"
|
store.mode === "shell"
|
||||||
? language.t("prompt.placeholder.shell")
|
? language.t("prompt.placeholder.shell")
|
||||||
: language.t("prompt.placeholder.normal", { example: language.t(EXAMPLES[store.placeholder]) })
|
: commentCount() > 1
|
||||||
|
? "Summarize comments…"
|
||||||
|
: commentCount() === 1
|
||||||
|
? "Summarize comment…"
|
||||||
|
: language.t("prompt.placeholder.normal", { example: language.t(EXAMPLES[store.placeholder]) })
|
||||||
}
|
}
|
||||||
contenteditable="true"
|
contenteditable="true"
|
||||||
onInput={handleInput}
|
onInput={handleInput}
|
||||||
@@ -1847,7 +1852,11 @@ export const PromptInput: Component<PromptInputProps> = (props) => {
|
|||||||
<div class="absolute top-0 inset-x-0 p-3 pr-12 text-14-regular text-text-weak pointer-events-none whitespace-nowrap truncate">
|
<div class="absolute top-0 inset-x-0 p-3 pr-12 text-14-regular text-text-weak pointer-events-none whitespace-nowrap truncate">
|
||||||
{store.mode === "shell"
|
{store.mode === "shell"
|
||||||
? language.t("prompt.placeholder.shell")
|
? language.t("prompt.placeholder.shell")
|
||||||
: language.t("prompt.placeholder.normal", { example: language.t(EXAMPLES[store.placeholder]) })}
|
: commentCount() > 1
|
||||||
|
? "Summarize comments…"
|
||||||
|
: commentCount() === 1
|
||||||
|
? "Summarize comment…"
|
||||||
|
: language.t("prompt.placeholder.normal", { example: language.t(EXAMPLES[store.placeholder]) })}
|
||||||
</div>
|
</div>
|
||||||
</Show>
|
</Show>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user