fix: minor ui issues

This commit is contained in:
Liyas Thomas
2023-12-07 17:12:33 +05:30
parent 6063c633ee
commit 87395a4553
8 changed files with 59 additions and 65 deletions

View File

@@ -164,6 +164,12 @@ declare module 'vue' {
IconLucideUsers: typeof import('~icons/lucide/users')['default'] IconLucideUsers: typeof import('~icons/lucide/users')['default']
IconLucideVerified: typeof import('~icons/lucide/verified')['default'] IconLucideVerified: typeof import('~icons/lucide/verified')['default']
IconLucideX: typeof import('~icons/lucide/x')['default'] IconLucideX: typeof import('~icons/lucide/x')['default']
ImportExportBase: typeof import('./components/importExport/Base.vue')['default']
ImportExportImportExportList: typeof import('./components/importExport/ImportExportList.vue')['default']
ImportExportImportExportSourcesList: typeof import('./components/importExport/ImportExportSourcesList.vue')['default']
ImportExportImportExportStepsFileImport: typeof import('./components/importExport/ImportExportSteps/FileImport.vue')['default']
ImportExportImportExportStepsMyCollectionImport: typeof import('./components/importExport/ImportExportSteps/MyCollectionImport.vue')['default']
ImportExportImportExportStepsUrlImport: typeof import('./components/importExport/ImportExportSteps/UrlImport.vue')['default']
InterceptorsErrorPlaceholder: typeof import('./components/interceptors/ErrorPlaceholder.vue')['default'] InterceptorsErrorPlaceholder: typeof import('./components/interceptors/ErrorPlaceholder.vue')['default']
InterceptorsExtensionSubtitle: typeof import('./components/interceptors/ExtensionSubtitle.vue')['default'] InterceptorsExtensionSubtitle: typeof import('./components/interceptors/ExtensionSubtitle.vue')['default']
LensesHeadersRenderer: typeof import('./components/lenses/HeadersRenderer.vue')['default'] LensesHeadersRenderer: typeof import('./components/lenses/HeadersRenderer.vue')['default']

View File

@@ -305,11 +305,10 @@ watch(isOnline, () => {
if (!isOnline.value) { if (!isOnline.value) {
bannerID = banner.showBanner(offlineBanner) bannerID = banner.showBanner(offlineBanner)
return return
} else { }
if (banner.content && bannerID) { if (banner.content && bannerID) {
banner.removeBanner(bannerID) banner.removeBanner(bannerID)
} }
}
}) })
const dismissOfflineBanner = () => banner.removeBanner(bannerID!) const dismissOfflineBanner = () => banner.removeBanner(bannerID!)

View File

@@ -1,17 +1,17 @@
<template> <template>
<div class="flex flex-1 flex-col"> <div class="flex flex-col flex-1">
<header <header
class="flex flex-1 flex-shrink-0 items-center justify-between space-x-2 overflow-x-auto overflow-y-hidden px-2 py-2" class="flex items-center justify-between flex-1 flex-shrink-0 px-2 py-2 space-x-2 overflow-x-auto overflow-y-hidden"
> >
<div class="flex flex-1 items-center justify-between space-x-2"> <div class="flex items-center justify-between flex-1 space-x-2">
<HoppButtonSecondary <HoppButtonSecondary
class="!font-bold uppercase tracking-wide !text-secondaryDark hover:bg-primaryDark focus-visible:bg-primaryDark" class="!font-bold uppercase tracking-wide !text-secondaryDark hover:bg-primaryDark focus-visible:bg-primaryDark"
:label="t('app.name')" :label="t('app.name')"
to="https://hoppscotch.io/" to="https://hoppscotch.io"
blank blank
/> />
<div class="flex"> <div class="flex">
<HoppSmartItem <HoppButtonSecondary
:label="t('app.open_in_hoppscotch')" :label="t('app.open_in_hoppscotch')"
:to="sharedRequestURL" :to="sharedRequestURL"
blank blank
@@ -19,42 +19,36 @@
</div> </div>
</div> </div>
</header> </header>
<div class="sticky top-0 z-10 flex-1">
<div class="flex-1">
<div <div
class="flex-none flex-shrink-0 bg-primary p-4 sm:flex sm:flex-shrink-0 sm:space-x-2" class="flex-none flex-shrink-0 p-4 bg-primary sm:flex sm:flex-shrink-0 sm:space-x-2"
> >
<div <div
class="min-w-52 flex flex-1 whitespace-nowrap rounded border border-divider" class="flex flex-1 overflow-hidden border divide-x rounded text-secondaryDark divide-divider min-w-[12rem] overflow-x-auto border-divider"
> >
<div class="relative flex">
<span <span
class="flex justify-center items-center w-26 cursor-pointer rounded-l bg-primaryLight px-4 py-2 font-semibold text-secondaryDark transition" class="flex items-center justify-center px-4 py-2 font-semibold transition rounded-l"
> >
{{ tab.document.request.method }} {{ tab.document.request.method }}
</span> </span>
</div>
<div <div
class="flex flex-1 whitespace-nowrap rounded-r border-l border-divider bg-primaryLight transition" class="flex items-center flex-1 flex-shrink-0 min-w-0 px-4 py-2 truncate rounded-r"
> >
<input {{ tab.document.request.endpoint }}
name="method"
:value="tab.document.request.endpoint"
class="flex-1 px-4 bg-primary"
disabled
/>
</div> </div>
</div> </div>
<div class="mt-2 flex sm:mt-0"> <div class="flex mt-2 space-x-2 sm:mt-0">
<HoppButtonPrimary <HoppButtonPrimary
id="send" id="send"
:title="`${t( :title="`${t(
'action.send' 'action.send'
)} <kbd>${getSpecialKey()}</kbd><kbd>↩</kbd>`" )} <kbd>${getSpecialKey()}</kbd><kbd>↩</kbd>`"
:label="`${!loading ? t('action.send') : t('action.cancel')}`" :label="`${!loading ? t('action.send') : t('action.cancel')}`"
class="min-w-20 flex-1" class="flex-1 min-w-20"
outline
@click="!loading ? newSendRequest() : cancelRequest()" @click="!loading ? newSendRequest() : cancelRequest()"
/> />
<div class="flex">
<HoppButtonSecondary <HoppButtonSecondary
:title="`${t( :title="`${t(
'request.save' 'request.save'
@@ -62,20 +56,20 @@
:label="t('request.save')" :label="t('request.save')"
filled filled
:icon="IconSave" :icon="IconSave"
class="flex-1 rounded rounded-r-none" class="flex-1 rounded"
blank blank
outline
:to="sharedRequestURL" :to="sharedRequestURL"
/> />
</div> </div>
</div> </div>
</div> </div>
</div>
<HttpRequestOptions <HttpRequestOptions
v-model="tab.document.request" v-model="tab.document.request"
v-model:option-tab="selectedOptionTab" v-model:option-tab="selectedOptionTab"
:properties="properties" :properties="properties"
/> />
<HttpResponse :document="tab.document" :is-embed="true" /> <HttpResponse :document="tab.document" :is-embed="true" />
</div> </div>
</template> </template>

View File

@@ -306,9 +306,8 @@ const embedThemeIcon = computed(() => {
return IconMonitor return IconMonitor
} else if (embedOptions.value.theme === "light") { } else if (embedOptions.value.theme === "light") {
return IconSun return IconSun
} else {
return IconMoon
} }
return IconMoon
}) })
const removeEmbedOption = (option: EmbedTabs) => { const removeEmbedOption = (option: EmbedTabs) => {
@@ -392,9 +391,8 @@ const copyButton = (
if (type === "markdown") { if (type === "markdown") {
return `[![Run in Hoppscotch](${baseURL}/${badge})](${baseURL}/r/${props.request?.id})` return `[![Run in Hoppscotch](${baseURL}/${badge})](${baseURL}/r/${props.request?.id})`
} else {
return `<a href="${baseURL}/r/${props.request?.id}"><img src="${baseURL}/${badge}" alt="Run in Hoppscotch" /></a>`
} }
return `<a href="${baseURL}/r/${props.request?.id}"><img src="${baseURL}/${badge}" alt="Run in Hoppscotch" /></a>`
} }
const copyLink = (variationID: string) => { const copyLink = (variationID: string) => {
@@ -402,9 +400,8 @@ const copyLink = (variationID: string) => {
return `${baseURL}/r/${props.request?.id}` return `${baseURL}/r/${props.request?.id}`
} else if (variationID === "link2") { } else if (variationID === "link2") {
return `<a href="${baseURL}/r/${props.request?.id}">Run in Hoppscotch</a>` return `<a href="${baseURL}/r/${props.request?.id}">Run in Hoppscotch</a>`
} else {
return `[Run in Hoppscotch](${baseURL}/r/${props.request?.id})`
} }
return `[Run in Hoppscotch](${baseURL}/r/${props.request?.id})`
} }
const copyContent = ({ const copyContent = ({

View File

@@ -29,17 +29,15 @@
@copy-shared-request="copySharedRequest" @copy-shared-request="copySharedRequest"
/> />
</template> </template>
<template v-if="step === 1" #footer>
<template #footer>
<div class="flex justify-start flex-1"> <div class="flex justify-start flex-1">
<HoppButtonPrimary <HoppButtonPrimary
v-if="step === 1"
:label="t('action.create')" :label="t('action.create')"
:loading="loading" :loading="loading"
@click="createSharedRequest" @click="createSharedRequest"
/> />
<HoppButtonSecondary <HoppButtonSecondary
:label="step === 1 ? t('action.cancel') : t('action.close')" :label="t('action.cancel')"
class="ml-2" class="ml-2"
filled filled
outline outline

View File

@@ -446,7 +446,7 @@ const resolveConfirmModal = (title: string | null) => {
const getErrorMessage = (err: GQLError<string>) => { const getErrorMessage = (err: GQLError<string>) => {
if (err.type === "network_error") { if (err.type === "network_error") {
return t("error.network_error") return t("error.network_error")
} else { }
switch (err.error) { switch (err.error) {
case "shortcode/not_found": case "shortcode/not_found":
return t("shared_request.not_found") return t("shared_request.not_found")
@@ -454,7 +454,6 @@ const getErrorMessage = (err: GQLError<string>) => {
return t("error.something_went_wrong") return t("error.something_went_wrong")
} }
} }
}
defineActionHandler("share.request", ({ request }) => { defineActionHandler("share.request", ({ request }) => {
requestToShare.value = request requestToShare.value = request

View File

@@ -11,7 +11,9 @@
'bg-accentContrast': isEmbedThemeLight, 'bg-accentContrast': isEmbedThemeLight,
}" }"
> >
<span class="flex items-center min-w-0 border rounded border-divider"> <span
class="flex items-center flex-1 min-w-0 border rounded border-divider"
>
<span <span
class="flex max-w-[4rem] rounded-l h-full items-center justify-center border-r border-divider text-tiny" class="flex max-w-[4rem] rounded-l h-full items-center justify-center border-r border-divider text-tiny"
:class="{ :class="{

View File

@@ -26,11 +26,10 @@ export type Banner = {
const getBannerWithHighestScore = (list: Banner[]) => { const getBannerWithHighestScore = (list: Banner[]) => {
if (list.length === 0) return null if (list.length === 0) return null
else if (list.length === 1) return list[0] else if (list.length === 1) return list[0]
else {
const highestScore = Math.max(...list.map((banner) => banner.content.score)) const highestScore = Math.max(...list.map((banner) => banner.content.score))
return list.find((banner) => banner.content.score === highestScore) return list.find((banner) => banner.content.score === highestScore)
} }
}
/** /**
* This service is used to display a banner on the app. * This service is used to display a banner on the app.