Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions packages/extension/public/_locales/de/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,9 @@
"Option_commandType_description": {
"message": "Bitte wählen Sie den Typ des Befehls, den Sie erstellen möchten"
},
"Option_commandType_hubLink": {
"message": "Befehle finden"
},
"Option_commandType_search_title": {
"message": "Suchen"
},
Expand Down
3 changes: 3 additions & 0 deletions packages/extension/public/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,9 @@
"Option_commandType_description": {
"message": "Please select the type of command you want to create"
},
"Option_commandType_hubLink": {
"message": "Find Commands"
},
"Option_commandType_search_title": {
"message": "Search"
},
Expand Down
3 changes: 3 additions & 0 deletions packages/extension/public/_locales/es/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,9 @@
"Option_commandType_description": {
"message": "Por favor seleccione el tipo de comando que desea crear"
},
"Option_commandType_hubLink": {
"message": "Buscar Comandos"
},
"Option_commandType_search_title": {
"message": "Búsqueda"
},
Expand Down
3 changes: 3 additions & 0 deletions packages/extension/public/_locales/fr/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,9 @@
"Option_commandType_description": {
"message": "Veuillez sélectionner le type de commande que vous souhaitez créer"
},
"Option_commandType_hubLink": {
"message": "Rechercher des Commandes"
},
"Option_commandType_search_title": {
"message": "Recherche"
},
Expand Down
3 changes: 3 additions & 0 deletions packages/extension/public/_locales/hi/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,9 @@
"Option_commandType_description": {
"message": "कृपया उस कमांड का प्रकार चुनें जिसे आप बनाना चाहते हैं"
},
"Option_commandType_hubLink": {
"message": "कमांड खोजें"
},
"Option_commandType_search_title": {
"message": "खोज"
},
Expand Down
3 changes: 3 additions & 0 deletions packages/extension/public/_locales/id/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,9 @@
"Option_commandType_description": {
"message": "Silakan pilih jenis perintah yang ingin Anda buat"
},
"Option_commandType_hubLink": {
"message": "Cari Perintah"
},
"Option_commandType_search_title": {
"message": "Pencarian"
},
Expand Down
3 changes: 3 additions & 0 deletions packages/extension/public/_locales/it/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,9 @@
"Option_commandType_description": {
"message": "Seleziona il tipo di comando che desideri creare"
},
"Option_commandType_hubLink": {
"message": "Cerca Comandi"
},
"Option_commandType_search_title": {
"message": "Ricerca"
},
Expand Down
3 changes: 3 additions & 0 deletions packages/extension/public/_locales/ja/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,9 @@
"Option_commandType_description": {
"message": "作成するコマンドの種類を選択してください"
},
"Option_commandType_hubLink": {
"message": "コマンドを探す"
},
"Option_commandType_search_title": {
"message": "検索"
},
Expand Down
3 changes: 3 additions & 0 deletions packages/extension/public/_locales/ko/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,9 @@
"Option_commandType_description": {
"message": "생성하려는 명령 유형을 선택하세요"
},
"Option_commandType_hubLink": {
"message": "명령 찾기"
},
"Option_commandType_search_title": {
"message": "검색"
},
Expand Down
3 changes: 3 additions & 0 deletions packages/extension/public/_locales/ms/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,9 @@
"Option_commandType_description": {
"message": "Sila pilih jenis arahan yang ingin anda cipta"
},
"Option_commandType_hubLink": {
"message": "Cari Arahan"
},
"Option_commandType_search_title": {
"message": "Carian"
},
Expand Down
3 changes: 3 additions & 0 deletions packages/extension/public/_locales/pt_BR/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,9 @@
"Option_commandType_description": {
"message": "Por favor, selecione o tipo de comando que deseja criar"
},
"Option_commandType_hubLink": {
"message": "Buscar Comandos"
},
"Option_commandType_search_title": {
"message": "Pesquisa"
},
Expand Down
3 changes: 3 additions & 0 deletions packages/extension/public/_locales/pt_PT/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,9 @@
"Option_commandType_description": {
"message": "Por favor, selecione o tipo de comando que deseja criar"
},
"Option_commandType_hubLink": {
"message": "Procurar Comandos"
},
"Option_commandType_search_title": {
"message": "Pesquisa"
},
Expand Down
3 changes: 3 additions & 0 deletions packages/extension/public/_locales/ru/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,9 @@
"Option_commandType_description": {
"message": "Пожалуйста, выберите тип команды, которую вы хотите создать"
},
"Option_commandType_hubLink": {
"message": "Найти команды"
},
"Option_commandType_search_title": {
"message": "Поиск"
},
Expand Down
3 changes: 3 additions & 0 deletions packages/extension/public/_locales/zh_CN/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,9 @@
"Option_commandType_description": {
"message": "请选择您要创建的命令类型"
},
"Option_commandType_hubLink": {
"message": "查找命令"
},
"Option_commandType_search_title": {
"message": "搜索"
},
Expand Down
3 changes: 3 additions & 0 deletions packages/extension/src/action/aiPrompt.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ const makeDomService = (overrides?: Partial<AiService>): AiService => ({
faviconUrl: "",
inputSelectors: [".ql-editor"],
submitSelectors: ["button.send"],
copySelectors: [],
selectorType: "css" as any,
...overrides,
})
Expand All @@ -70,6 +71,7 @@ const makeQueryService = (overrides?: Partial<AiService>): AiService => ({
faviconUrl: "",
inputSelectors: ["#prompt-textarea"],
submitSelectors: ["button#submit"],
copySelectors: [],
selectorType: "css" as any,
queryUrl: "https://chatgpt.com/?prompt=%s",
autoSubmit: false,
Expand All @@ -83,6 +85,7 @@ const makeAutoSubmitService = (overrides?: Partial<AiService>): AiService => ({
faviconUrl: "",
inputSelectors: ["div#ask-input"],
submitSelectors: ["button[aria-label='Submit']"],
copySelectors: [],
selectorType: "css" as any,
queryUrl: "https://www.perplexity.ai/search/new?q=%s",
autoSubmit: true,
Expand Down
62 changes: 32 additions & 30 deletions packages/extension/src/components/option/SettingForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -479,18 +479,20 @@ export function SettingForm({ className }: { className?: string }) {
)}

{startupMethod !== STARTUP_METHOD.CONTEXT_MENU && (
<PopupAnimation
onSubmit={handlePopupAnimationSubmit}
defaultValues={getAnimationDefaultValues()}
/>
)}
<>
<PopupAnimation
onSubmit={handlePopupAnimationSubmit}
defaultValues={getAnimationDefaultValues()}
/>

<SwitchField
control={form.control}
name="startupMethod.keepMenuOpenOnFocusChange"
formLabel={t("keepMenuOpenOnFocusChange")}
tooltip={t("keepMenuOpenOnFocusChange_desc")}
/>
<SwitchField
control={form.control}
name="startupMethod.keepMenuOpenOnFocusChange"
formLabel={t("keepMenuOpenOnFocusChange")}
tooltip={t("keepMenuOpenOnFocusChange_desc")}
/>
</>
)}
</section>
<hr />
<section id="commands" className="space-y-3">
Expand Down Expand Up @@ -576,25 +578,25 @@ export function SettingForm({ className }: { className?: string }) {
)}
{linkCommandMethod ===
LINK_COMMAND_STARTUP_METHOD.LEFT_CLICK_HOLD && (
<InputField
control={form.control}
name="linkCommand.startupMethod.leftClickHoldParam"
formLabel={t("linkCommandStartupMethod_leftClickHoldParam")}
description={t(
"linkCommandStartupMethod_leftClickHoldParam_desc",
)}
unit="ms"
inputProps={{
type: "number",
min: 50,
max: 500,
step: 10,
...register("linkCommand.startupMethod.leftClickHoldParam", {
valueAsNumber: true,
}),
}}
/>
)}
<InputField
control={form.control}
name="linkCommand.startupMethod.leftClickHoldParam"
formLabel={t("linkCommandStartupMethod_leftClickHoldParam")}
description={t(
"linkCommandStartupMethod_leftClickHoldParam_desc",
)}
unit="ms"
inputProps={{
type: "number",
min: 50,
max: 500,
step: 10,
...register("linkCommand.startupMethod.leftClickHoldParam", {
valueAsNumber: true,
}),
}}
/>
)}
<SwitchField
control={form.control}
name="linkCommand.showIndicator"
Expand Down
44 changes: 34 additions & 10 deletions packages/extension/src/components/option/ShareButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { cn, isUUIDv7, generateId } from "@/lib/utils"
import { t } from "@/services/i18n"
import { shareCommandToHub, getHubLocale } from "@/services/hubShare"
import { sendEvent, ANALYTICS_EVENTS } from "@/services/analytics"
import { Storage, LOCAL_STORAGE_KEY } from "@/services/storage"
import {
NEW_HUB_SHAREABLE_OPEN_MODES,
COMMAND_SOURCE_TYPE,
Expand Down Expand Up @@ -35,9 +36,11 @@ export const ShareButton = ({
isShared,
}: Props) => {
const buttonRef = useRef<HTMLButtonElement>(null)
const [status, setStatus] = useState<"idle" | "sent" | "error">("idle")
const [status, setStatus] = useState<"idle" | "pending" | "sent" | "error">(
"idle",
)

const handleClick = (e: React.MouseEvent) => {
const handleClick = async (e: React.MouseEvent) => {
e.stopPropagation()

if (isShared) {
Expand All @@ -48,6 +51,10 @@ export const ShareButton = ({
return
}

// Disable the button immediately to prevent duplicate shares/signup
// tabs from rapid repeated clicks while the storage lookup below runs.
setStatus("pending")

let commandToShare = command
if (!isUUIDv7(command.id)) {
const newId = generateId()
Expand All @@ -56,16 +63,33 @@ export const ShareButton = ({
}

const ok = shareCommandToHub(commandToShare)
setStatus(ok ? "sent" : "error")
setTimeout(() => setStatus("idle"), 2000)

if (ok) {
sendEvent(
ANALYTICS_EVENTS.COMMAND_SHARE,
{ event_label: "share-button" },
SCREEN.OPTION,
)
if (!ok) {
setStatus("error")
setTimeout(() => setStatus("idle"), 2000)
return
}

// Users who have never signed in to the hub are redirected to the
// sign-up page instead (see shareCommandToHub in services/hub/background.ts);
// nothing is actually shared yet, so leave the button idle and skip
// the share analytics event for this case.
const registered = await Storage.get<boolean>(
LOCAL_STORAGE_KEY.HUB_REGISTERED,
)
if (!registered) {
setStatus("idle")
return
}

setStatus("sent")
setTimeout(() => setStatus("idle"), 2000)

sendEvent(
ANALYTICS_EVENTS.COMMAND_SHARE,
{ event_label: "share-button" },
SCREEN.OPTION,
)
}

if (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,13 @@ const getDefault = (
) => {
const sourceDefaults = isEmpty(base?.id)
? {
sourceType: base?.sourceType ?? COMMAND_SOURCE_TYPE.SELF_CREATED,
sourceId: base?.sourceId ?? COMMAND_SOURCE_ID.SELF_CREATED,
}
sourceType: base?.sourceType ?? COMMAND_SOURCE_TYPE.SELF_CREATED,
sourceId: base?.sourceId ?? COMMAND_SOURCE_ID.SELF_CREATED,
}
: {
sourceType: base?.sourceType,
sourceId: base?.sourceId,
}
sourceType: base?.sourceType,
sourceId: base?.sourceId,
}

if (isSearchOpenMode(openMode)) {
if (isSearchOpenMode(preOpenMode)) {
Expand Down Expand Up @@ -610,6 +610,7 @@ const CommandEditDialogInner = ({
const parsedUrl = parseGeminiUrl(value)
if (parsedUrl !== value) {
setValue("searchUrl", parsedUrl)
clearErrors("searchUrl")
}
field.onBlur()
}}
Expand Down
Loading
Loading