feat: move crisp out of common (#3287)

* feat: move crisp out of common

* fix: update static spotlight searcher

* chore: fix typo
This commit is contained in:
Andrew Bastin
2023-08-26 03:00:58 +05:30
committed by GitHub
parent d4d7a20fbd
commit a7566dfd86
17 changed files with 325 additions and 319 deletions

View File

@@ -7,9 +7,11 @@ import { HistoryPlatformDef } from "./history"
import { TabStatePlatformDef } from "./tab"
import { AnalyticsPlatformDef } from "./analytics"
import { InterceptorsPlatformDef } from "./interceptors"
import { HoppModule } from "~/modules"
export type PlatformDef = {
ui?: UIPlatformDef
addedHoppModules?: HoppModule[]
auth: AuthPlatformDef
analytics?: AnalyticsPlatformDef
sync: {

View File

@@ -0,0 +1,25 @@
import { HoppFooterMenuItem } from "../../ui"
import IconGift from "~icons/lucide/gift"
import IconActivity from "~icons/lucide/activity"
export const whatsNew: HoppFooterMenuItem = {
id: "whats-new",
text: (t) => t("app.whats_new"),
icon: IconGift,
action: {
type: "link",
href: "https://docs.hoppscotch.io/documentation/changelog",
},
}
export const status: HoppFooterMenuItem = {
id: "status",
text: (t) => t("app.status"),
icon: IconActivity,
action: {
type: "link",
href: "https://status.hoppscotch.io",
},
}
export const stdFooterItems = [whatsNew, status]

View File

@@ -0,0 +1,110 @@
import { invokeAction } from "~/helpers/actions"
import { HoppSupportOptionsMenuItem } from "~/platform/ui"
import IconBook from "~icons/lucide/book"
import IconGift from "~icons/lucide/gift"
import IconZap from "~icons/lucide/zap"
import IconGitHub from "~icons/lucide/github"
import IconTwitter from "~icons/brands/twitter"
import IconDiscord from "~icons/brands/discord"
import IconUserPlus from "~icons/lucide/user-plus"
export const documentation: HoppSupportOptionsMenuItem = {
id: "documentation",
text: (t) => t("app.documentation"),
subtitle: (t) => t("support.documentation"),
icon: IconBook,
action: {
type: "link",
href: "https://docs.hoppscotch.io",
},
}
export const shortcuts: HoppSupportOptionsMenuItem = {
id: "shortcuts",
text: (t) => t("app.keyboard_shortcuts"),
subtitle: (t) => t("support.shortcuts"),
icon: IconZap,
action: {
type: "custom",
do() {
invokeAction("flyouts.keybinds.toggle")
},
},
}
export const changelog: HoppSupportOptionsMenuItem = {
id: "changelog",
text: (t) => t("app.whats_new"),
subtitle: (t) => t("support.changelog"),
icon: IconGift,
action: {
type: "link",
href: "https://docs.hoppscotch.io/documentation/changelog",
},
}
export const github: HoppSupportOptionsMenuItem = {
id: "github",
text: (t) => t("app.github"),
subtitle: (t) => t("support.github"),
icon: IconGitHub,
action: {
type: "link",
href: "https://hoppscotch.io/github",
},
}
export const discord: HoppSupportOptionsMenuItem = {
id: "discord",
text: (t) => t("app.join_discord_community"),
subtitle: (t) => t("support.community"),
icon: IconDiscord,
action: {
type: "link",
href: "https://hoppscotch.io/discord",
},
}
export const twitter: HoppSupportOptionsMenuItem = {
id: "discord",
text: (t) => t("app.twitter"),
subtitle: (t) => t("support.twitter"),
icon: IconTwitter,
action: {
type: "link",
href: "https://hoppscotch.io/discord",
},
}
export const invite: HoppSupportOptionsMenuItem = {
id: "invite",
text: (t) => t("app.invite"),
subtitle: (t) => t("shortcut.miscellaneous.invite"),
icon: IconUserPlus,
action: {
type: "custom",
do() {
if (navigator.share) {
navigator
.share({
title: "Hoppscotch",
text: "Hoppscotch • Open source API development ecosystem - Helps you create requests faster, saving precious time on development.",
url: "https://hoppscotch.io",
})
.catch(console.error)
} else {
// fallback
}
},
},
}
export const stdSupportOptionItems: HoppSupportOptionsMenuItem[] = [
documentation,
shortcuts,
changelog,
github,
discord,
twitter,
invite,
]

View File

@@ -1,4 +1,20 @@
import { Ref } from "vue"
import { Ref, Component } from "vue"
import { getI18n } from "~/modules/i18n"
export type HoppFooterMenuItem = {
id: string
text: (t: ReturnType<typeof getI18n>) => string
icon: Component
action: { type: "link"; href: string } | { type: "custom"; do: () => void }
}
export type HoppSupportOptionsMenuItem = {
id: string
text: (t: ReturnType<typeof getI18n>) => string
subtitle: (t: ReturnType<typeof getI18n>) => string
icon: Component
action: { type: "link"; href: string } | { type: "custom"; do: () => void }
}
export type UIPlatformDef = {
appHeader?: {
@@ -6,4 +22,15 @@ export type UIPlatformDef = {
paddingLeft?: Ref<string>
}
onCodemirrorInstanceMount?: (element: HTMLElement) => void
/**
* Additonal menu items shown in the "Help and Feedback" menu
* in the app footer.
*/
additionalFooterMenuItems?: HoppFooterMenuItem[]
/**
* Additional Support Options menu items shown in the app header
*/
additionalSupportOptionsMenuItems?: HoppSupportOptionsMenuItem[]
}