fix: ui styles

This commit is contained in:
Liyas Thomas
2023-12-06 23:34:02 +05:30
committed by Andrew Bastin
parent f2777a9a75
commit 502da61b8b
8 changed files with 93 additions and 77 deletions

View File

@@ -434,7 +434,7 @@
"confirm": "Confirm", "confirm": "Confirm",
"customize_request": "Customize Request", "customize_request": "Customize Request",
"edit_request": "Edit Request", "edit_request": "Edit Request",
"share_request":"Share Request", "share_request": "Share Request",
"import_export": "Import / Export" "import_export": "Import / Export"
}, },
"mqtt": { "mqtt": {
@@ -623,30 +623,30 @@
"additional": "Additional Settings", "additional": "Additional Settings",
"verify_email": "Verify email" "verify_email": "Verify email"
}, },
"shared_requests":{ "shared_requests": {
"button":"Button", "button": "Button",
"button_info": "Create a 'Run in Hoppscotch' button for your website, blog or a README.", "button_info": "Create a 'Run in Hoppscotch' button for your website, blog or a README.",
"customize": "Customize", "customize": "Customize",
"creating_widget": "Creating widget", "creating_widget": "Creating widget",
"copy_html": "Copy HTML", "copy_html": "Copy HTML",
"copy_link": "Copy Link", "copy_link": "Copy Link",
"copy_markdown": "Copy Markdown", "copy_markdown": "Copy Markdown",
"deleted":"Shared request deleted", "deleted": "Shared request deleted",
"description": "Select a widget, you can change and customize this later", "description": "Select a widget, you can change and customize this later",
"embed":"Embed", "embed": "Embed",
"embed_info": "Add a mini 'Hoppscotch API Playground' to your website, blog or documentation.", "embed_info": "Add a mini 'Hoppscotch API Playground' to your website, blog or documentation.",
"link":"Link", "link": "Link",
"link_info": "Create a shareable link to share with anyone on the internet with view access.", "link_info": "Create a shareable link to share with anyone on the internet with view access.",
"modified": "Shared request modified", "modified": "Shared request modified",
"not_found":"Shared request not found", "not_found": "Shared request not found",
"open_new_tab": "Open in new tab", "open_new_tab": "Open in new tab",
"preview":"Preview", "preview": "Preview",
"run_in_hoppscotch":"Run in Hoppscotch", "run_in_hoppscotch": "Run in Hoppscotch",
"theme":{ "theme": {
"dark":"Dark", "dark": "Dark",
"light":"Light", "light": "Light",
"system" :"System", "system": "System",
"title":"Theme" "title": "Theme"
} }
}, },
"shortcut": { "shortcut": {
@@ -692,7 +692,7 @@
"save_to_collections": "Save to Collections", "save_to_collections": "Save to Collections",
"send_request": "Send Request", "send_request": "Send Request",
"show_code": "Generate code snippet", "show_code": "Generate code snippet",
"share_request":"Share Request", "share_request": "Share Request",
"title": "Request" "title": "Request"
}, },
"response": { "response": {

View File

@@ -1,7 +1,7 @@
<template> <template>
<div <div
v-if="selectedWidget" v-if="selectedWidget"
class="divide-y divide-divider rounded border border-divider" class="border divide-y rounded divide-divider border-divider"
> >
<div v-if="loading" class="px-4 py-2"> <div v-if="loading" class="px-4 py-2">
{{ t("shared_requests.creating_widget") }} {{ t("shared_requests.creating_widget") }}
@@ -10,17 +10,17 @@
{{ t("shared_requests.description") }} {{ t("shared_requests.description") }}
</div> </div>
<div class="flex flex-col divide-y divide-divider"> <div class="flex flex-col divide-y divide-divider">
<div class="flex flex-col space-y-4 p-4"> <div class="flex flex-col p-4 space-y-4">
<div <div
v-for="widget in widgets" v-for="widget in widgets"
:key="widget.value" :key="widget.value"
class="flex cursor-pointer flex-col space-y-2 rounded border border-divider px-4 py-3 hover:bg-dividerLight" class="flex flex-col p-4 border rounded cursor-pointer border-divider hover:bg-dividerLight"
:class="{ :class="{
'!border-accentLight': selectedWidget.value === widget.value, '!border-accentLight': selectedWidget.value === widget.value,
}" }"
@click="selectedWidget = widget" @click="selectedWidget = widget"
> >
<span class="text-md font-bold"> <span class="mb-1 font-bold text-secondaryDark">
{{ widget.label }} {{ widget.label }}
</span> </span>
<span class="text-tiny"> <span class="text-tiny">
@@ -28,9 +28,13 @@
</span> </span>
</div> </div>
</div> </div>
<div class="flex flex-col divide-y divide-divider"> <div class="flex flex-col items-center justify-center p-4">
<div class="px-4 py-3">{{ t("shared_requests.preview") }}</div> <span
<div class="flex flex-col items-center justify-center px-4 py-10"> class="flex justify-center flex-1 mb-2 text-secondaryLight text-tiny"
>
{{ t("shared_requests.preview") }}
</span>
<div class="w-full">
<ShareTemplatesEmbeds <ShareTemplatesEmbeds
v-if="selectedWidget.value === 'embed'" v-if="selectedWidget.value === 'embed'"
:endpoint="request?.endpoint" :endpoint="request?.endpoint"

View File

@@ -1,7 +1,7 @@
<template> <template>
<div <div
v-if="selectedWidget" v-if="selectedWidget"
class="divide-y divide-divider rounded border border-divider" class="border divide-y rounded divide-divider border-divider"
> >
<div v-if="loading" class="px-4 py-2"> <div v-if="loading" class="px-4 py-2">
{{ t("shared_requests.creating_widget") }} {{ t("shared_requests.creating_widget") }}
@@ -14,7 +14,7 @@
<span class="text-secondaryLight">{{ t("state.loading") }}</span> <span class="text-secondaryLight">{{ t("state.loading") }}</span>
</div> </div>
<div v-else class="flex flex-col divide-y divide-divider"> <div v-else class="flex flex-col divide-y divide-divider">
<div class="flex flex-col space-y-4 p-4"> <div class="flex flex-col p-2 space-y-2">
<HoppSmartRadioGroup <HoppSmartRadioGroup
v-model="selectedWidget.value" v-model="selectedWidget.value"
:radios="widgets" :radios="widgets"
@@ -22,9 +22,9 @@
/> />
</div> </div>
<div class="flex flex-col divide-y divide-divider"> <div class="flex flex-col divide-y divide-divider">
<div class="flex items-center justify-center px-4 py-8"> <div class="flex items-center justify-center px-6 py-4">
<div v-if="selectedWidget.value === 'embed'" class="w-full flex-1"> <div v-if="selectedWidget.value === 'embed'" class="w-full">
<div class="flex flex-col pb-8"> <div class="flex flex-col pb-4">
<div <div
v-for="option in embedOptions.tabs" v-for="option in embedOptions.tabs"
:key="option.value" :key="option.value"
@@ -36,7 +36,8 @@
<HoppSmartCheckbox <HoppSmartCheckbox
:on="option.enabled" :on="option.enabled"
@change="removeEmbedOption(option.value)" @change="removeEmbedOption(option.value)"
/> >
</HoppSmartCheckbox>
</div> </div>
<div class="flex items-center justify-between"> <div class="flex items-center justify-between">
<span> <span>
@@ -49,13 +50,11 @@
theme="popover" theme="popover"
:on-shown="() => tippyActions!.focus()" :on-shown="() => tippyActions!.focus()"
> >
<span class="select-wrapper">
<HoppButtonSecondary <HoppButtonSecondary
class="ml-2 rounded-none pr-8 capitalize" class="!py-2 !px-0 capitalize"
:label="embedOptions.theme" :label="embedOptions.theme"
:icon="embedThemeIcon" :icon="embedThemeIcon"
/> />
</span>
<template #content="{ hide }"> <template #content="{ hide }">
<div <div
ref="tippyActions" ref="tippyActions"
@@ -102,14 +101,20 @@
</div> </div>
</div> </div>
</div> </div>
<span
class="flex justify-center mb-2 text-secondaryLight text-tiny"
>
{{ t("shared_requests.preview") }}
</span>
<ShareTemplatesEmbeds <ShareTemplatesEmbeds
:endpoint="request?.endpoint" :endpoint="request?.endpoint"
:method="request?.method" :method="request?.method"
:model-value="embedOptions" :model-value="embedOptions"
/> />
<div class="flex items-center justify-center py-4"> <div class="flex items-center justify-center">
<HoppButtonSecondary <HoppButtonSecondary
:label="t('shared_requests.copy_html')" :label="t('shared_requests.copy_html')"
class="underline text-secondaryDark"
@click=" @click="
copyContent({ copyContent({
widget: 'embed', widget: 'embed',
@@ -126,12 +131,18 @@
<div <div
v-for="variant in buttonVariants" v-for="variant in buttonVariants"
:key="variant.id" :key="variant.id"
class="flex flex-col space-y-4" class="flex flex-col"
> >
<span
class="flex justify-center mb-2 text-secondaryLight text-tiny"
>
{{ t("shared_requests.preview") }}
</span>
<ShareTemplatesButton :img="variant.img" /> <ShareTemplatesButton :img="variant.img" />
<div class="flex items-center justify-between"> <div class="flex items-center justify-between">
<HoppButtonSecondary <HoppButtonSecondary
:label="t('shared_requests.copy_html')" :label="t('shared_requests.copy_html')"
class="underline text-secondaryDark"
@click=" @click="
copyContent({ copyContent({
widget: 'button', widget: 'button',
@@ -142,6 +153,7 @@
/> />
<HoppButtonSecondary <HoppButtonSecondary
:label="t('shared_requests.copy_markdown')" :label="t('shared_requests.copy_markdown')"
class="underline text-secondaryDark"
@click=" @click="
copyContent({ copyContent({
widget: 'button', widget: 'button',
@@ -157,12 +169,17 @@
<div <div
v-for="variant in linkVariants" v-for="variant in linkVariants"
:key="variant.type" :key="variant.type"
class="flex flex-col items-center justify-center space-y-2" class="flex flex-col items-center justify-center"
> >
<span
class="flex justify-center mb-2 text-secondaryLight text-tiny"
>
{{ t("shared_requests.preview") }}
</span>
<ShareTemplatesLink :link="variant.link" :label="variant.label" /> <ShareTemplatesLink :link="variant.link" :label="variant.label" />
<HoppButtonSecondary <HoppButtonSecondary
:label="t(`shared_requests.copy_${variant.type}`)" :label="t(`shared_requests.copy_${variant.type}`)"
class="underline text-secondaryDark"
@click=" @click="
copyContent({ copyContent({
widget: 'link', widget: 'link',

View File

@@ -1,31 +1,31 @@
<template> <template>
<div <div
class="group flex items-stretch" class="flex items-stretch group"
@contextmenu.prevent="options!.tippy.show()" @contextmenu.prevent="options!.tippy.show()"
> >
<div <div
v-tippy="{ theme: 'tooltip', delay: [500, 20] }" v-tippy="{ theme: 'tooltip', delay: [500, 20] }"
class="pointer-events-auto flex min-w-0 flex-1 cursor-pointer items-center justify-center py-2" class="flex items-center justify-center flex-1 min-w-0 py-2 cursor-pointer pointer-events-auto"
:title="`${timeStamp}`" :title="`${timeStamp}`"
@click="openInNewTab" @click="openInNewTab"
> >
<span <span
class="pointer-events-none flex w-16 items-center justify-center truncate px-2" class="flex items-center justify-center w-16 px-2 truncate pointer-events-none"
:style="{ color: requestLabelColor }" :style="{ color: requestLabelColor }"
> >
<span class="truncate text-tiny font-semibold"> <span class="font-semibold truncate text-tiny">
{{ parseRequest.method }} {{ parseRequest.method }}
</span> </span>
</span> </span>
<span <span
class="pointer-events-none flex min-w-0 flex-1 items-center pr-2 transition group-hover:text-secondaryDark" class="flex items-center flex-1 min-w-0 pr-2 transition pointer-events-none group-hover:text-secondaryDark"
> >
<span class="flex-1 truncate"> <span class="flex-1 truncate">
{{ parseRequest.endpoint }} {{ parseRequest.endpoint }}
</span> </span>
</span> </span>
<span <span
class="flex-1 truncate border-l border-dividerDark px-2 text-secondaryLight group-hover:text-secondaryDark" class="flex px-2 truncate text-secondaryLight group-hover:text-secondaryDark"
> >
{{ parseRequest.name }} {{ parseRequest.name }}
</span> </span>
@@ -69,7 +69,7 @@
/> />
<HoppSmartItem <HoppSmartItem
ref="customizeAction" ref="customizeAction"
:icon="IconFileEdit" :icon="IconCustomize"
:label="`${t('shared_requests.customize')}`" :label="`${t('shared_requests.customize')}`"
:shortcut="['E']" :shortcut="['E']"
@click=" @click="
@@ -110,7 +110,7 @@ import { getMethodLabelColorClassOf } from "~/helpers/rest/labelColoring"
import { Shortcode } from "~/helpers/shortcode/Shortcode" import { Shortcode } from "~/helpers/shortcode/Shortcode"
import IconArrowUpRight from "~icons/lucide/arrow-up-right-square" import IconArrowUpRight from "~icons/lucide/arrow-up-right-square"
import IconMoreVertical from "~icons/lucide/more-vertical" import IconMoreVertical from "~icons/lucide/more-vertical"
import IconFileEdit from "~icons/lucide/file-edit" import IconCustomize from "~icons/lucide/settings-2"
import IconTrash2 from "~icons/lucide/trash-2" import IconTrash2 from "~icons/lucide/trash-2"
import { shortDateTime } from "~/helpers/utils/date" import { shortDateTime } from "~/helpers/utils/date"
@@ -135,6 +135,7 @@ const tippyActions = ref<TippyComponent | null>(null)
const openInNewTabAction = ref<HTMLButtonElement | null>(null) const openInNewTabAction = ref<HTMLButtonElement | null>(null)
const customizeAction = ref<HTMLButtonElement | null>(null) const customizeAction = ref<HTMLButtonElement | null>(null)
const deleteAction = ref<HTMLButtonElement | null>(null) const deleteAction = ref<HTMLButtonElement | null>(null)
const options = ref<any | null>(null)
const parseRequest = computed(() => const parseRequest = computed(() =>
pipe(props.request.request, JSON.parse, translateToNewRequest) pipe(props.request.request, JSON.parse, translateToNewRequest)

View File

@@ -1,10 +1,6 @@
<template> <template>
<div <div class="flex flex-col items-center p-4 border rounded border-dividerDark">
class="flex items-center justify-center rounded border border-dotted border-dividerDark p-5"
>
<a href="/" target="_blank">
<img :src="img" :alt="t('shared_requests.run_in_hoppscotch')" /> <img :src="img" :alt="t('shared_requests.run_in_hoppscotch')" />
</a>
</div> </div>
</template> </template>

View File

@@ -1,32 +1,30 @@
<template> <template>
<div <div
class="flex flex-col rounded border border-dotted border-divider p-5" class="flex flex-col p-4 border rounded border-dividerDark"
:class="{ :class="{
'bg-accentContrast': isEmbedThemeLight, 'bg-accentContrast': isEmbedThemeLight,
}" }"
> >
<div <div
class="flex items-stretch space-x-2 rounded border-divider" class="flex items-stretch space-x-2"
:class="{ :class="{
'bg-accentContrast': isEmbedThemeLight, 'bg-accentContrast': isEmbedThemeLight,
}" }"
> >
<span class="flex items-center min-w-0 border rounded border-divider">
<span <span
class="flex max-w-[4rem] items-center justify-center rounded border border-divider p-2 text-tiny" class="flex max-w-[4rem] rounded-l h-full items-center justify-center border-r border-divider text-tiny"
:class="{ :class="{
'!border-dividerLight bg-accentContrast text-primary': '!border-dividerLight bg-accentContrast text-primary':
isEmbedThemeLight, isEmbedThemeLight,
}" }"
> >
<span class="truncate"> <span class="px-3 truncate">
{{ method }} {{ method }}
</span> </span>
</span> </span>
<span <span
class="flex max-w-46 items-center rounded border border-divider p-2" class="px-3 truncate"
>
<span
class="min-w-0 truncate"
:class="{ :class="{
'text-primary': isEmbedThemeLight, 'text-primary': isEmbedThemeLight,
}" }"
@@ -35,7 +33,7 @@
</span> </span>
</span> </span>
<button <button
class="flex items-center justify-center rounded border border-dividerDark bg-primaryDark px-3 py-2 font-semibold text-secondary" class="flex items-center justify-center flex-shrink-0 px-3 py-2 font-semibold border rounded border-dividerDark bg-primaryDark text-secondary"
:class="{ :class="{
'!bg-accentContrast text-primaryLight': isEmbedThemeLight, '!bg-accentContrast text-primaryLight': isEmbedThemeLight,
}" }"
@@ -44,10 +42,10 @@
</button> </button>
</div> </div>
<div <div
class="flex border-divider" class="flex"
:class="{ :class="{
'bg-accentContrast text-primary': isEmbedThemeLight, 'bg-accentContrast text-primary': isEmbedThemeLight,
'border-b pt-2 ': !noActiveTab, 'border-b border-divider pt-2': !noActiveTab,
}" }"
> >
<span <span
@@ -57,7 +55,8 @@
class="px-2 py-2" class="px-2 py-2"
:class="{ :class="{
'border-b border-dividerDark': 'border-b border-dividerDark':
embedOptions.selectedTab === option.value, embedOptions.tabs.filter((tab) => tab.enabled)[0]?.value ===
option.value,
}" }"
> >
{{ option.label }} {{ option.label }}

View File

@@ -1,7 +1,5 @@
<template> <template>
<div <div class="flex flex-col items-center p-4 border rounded border-dividerDark">
class="flex items-center justify-center rounded border border-dotted border-dividerDark p-5"
>
<span <span
:class="{ :class="{
'border-b border-secondary': label, 'border-b border-secondary': label,

View File

@@ -75,6 +75,7 @@ const emit = defineEmits<{
@apply w-4; @apply w-4;
@apply mr-2; @apply mr-2;
@apply transition; @apply transition;
@apply empty:mr-0;
content: ""; content: "";
} }