chore(ui): improve ui consistency

This commit is contained in:
liyasthomas
2021-12-24 08:12:35 +05:30
parent 1eb9eb911e
commit 10cb433e80
17 changed files with 90 additions and 48 deletions

View File

@@ -0,0 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<polyline points="22 12 18 12 15 21 9 3 6 12 2 12"></polyline>
</svg>

After

Width:  |  Height:  |  Size: 253 B

View File

@@ -45,11 +45,11 @@
--secondary-light-color: theme("colors.true-gray.500"); --secondary-light-color: theme("colors.true-gray.500");
--secondary-dark-color: theme("colors.true-gray.100"); --secondary-dark-color: theme("colors.true-gray.100");
--divider-color: theme("colors.true-gray.800"); --divider-color: theme("colors.true-gray.800");
--divider-light-color: theme("colors.dark.700"); --divider-light-color: theme("colors.dark.800");
--divider-dark-color: theme("colors.dark.300"); --divider-dark-color: theme("colors.dark.300");
--error-color: theme("colors.warm-gray.900"); --error-color: theme("colors.warm-gray.900");
--tooltip-color: theme("colors.true-gray.100"); --tooltip-color: theme("colors.true-gray.100");
--popover-color: theme("colors.dark.700"); --popover-color: theme("colors.dark.600");
--editor-theme: "twilight"; --editor-theme: "twilight";
} }

View File

@@ -97,6 +97,20 @@
} }
" "
/> />
<SmartItem
svg="gift"
:label="`${t('app.whats_new')}`"
to="https://docs.hoppscotch.io/changelog"
blank
@click.native="options.tippy().hide()"
/>
<SmartItem
svg="activity"
:label="t('app.status')"
to="https://status.hoppscotch.io"
blank
@click.native="options.tippy().hide()"
/>
<hr /> <hr />
<SmartItem <SmartItem
svg="github" svg="github"
@@ -129,14 +143,6 @@
blank blank
@click.native="options.tippy().hide()" @click.native="options.tippy().hide()"
/> />
<SmartItem
svg="gift"
:label="`${t('app.whats_new')}`"
to="https://docs.hoppscotch.io/changelog"
blank
@click.native="options.tippy().hide()"
/>
<!-- <SmartItem :label="t('app.status')" /> -->
<div class="flex opacity-50 py-2 px-4"> <div class="flex opacity-50 py-2 px-4">
{{ `${t("app.name")} ${t("app.version")}` }} {{ `${t("app.name")} ${t("app.version")}` }}
</div> </div>

View File

@@ -85,6 +85,15 @@
svg="user" svg="user"
/> />
</template> </template>
<div class="flex text-tiny px-2 flex-col">
<span class="inline-flex truncate font-semibold">
{{ currentUser.displayName }}
</span>
<span class="inline-flex truncate text-secondaryLight">
{{ currentUser.email }}
</span>
</div>
<hr />
<div <div
ref="tippyActions" ref="tippyActions"
class="flex flex-col focus:outline-none" class="flex flex-col focus:outline-none"

View File

@@ -1,10 +1,10 @@
<template> <template>
<div class="flex flex-col space-y-4 p-4 items-start"> <div class="flex flex-col space-y-4 p-4">
<div class="flex flex-col"> <div class="flex flex-col">
<h2 class="inline-flex font-semibold text-secondaryDark pb-2"> <h2 class="inline-flex font-semibold text-secondaryDark pb-1">
{{ t("settings.interceptor") }} {{ t("settings.interceptor") }}
</h2> </h2>
<p class="inline-flex"> <p class="inline-flex text-tiny">
{{ t("settings.interceptor_description") }} {{ t("settings.interceptor_description") }}
</p> </p>
</div> </div>

View File

@@ -29,6 +29,7 @@
? 'radio_button_checked' ? 'radio_button_checked'
: 'radio_button_unchecked' : 'radio_button_unchecked'
" "
:active="authName === 'None'"
@click.native=" @click.native="
() => { () => {
authType = 'none' authType = 'none'
@@ -43,6 +44,7 @@
? 'radio_button_checked' ? 'radio_button_checked'
: 'radio_button_unchecked' : 'radio_button_unchecked'
" "
:active="authName === 'Basic Auth'"
@click.native=" @click.native="
() => { () => {
authType = 'basic' authType = 'basic'
@@ -57,6 +59,7 @@
? 'radio_button_checked' ? 'radio_button_checked'
: 'radio_button_unchecked' : 'radio_button_unchecked'
" "
:active="authName === 'Bearer'"
@click.native=" @click.native="
() => { () => {
authType = 'bearer' authType = 'bearer'
@@ -71,6 +74,7 @@
? 'radio_button_checked' ? 'radio_button_checked'
: 'radio_button_unchecked' : 'radio_button_unchecked'
" "
:active="authName === 'OAuth 2.0'"
@click.native=" @click.native="
() => { () => {
authType = 'oauth-2' authType = 'oauth-2'
@@ -85,6 +89,7 @@
? 'radio_button_checked' ? 'radio_button_checked'
: 'radio_button_unchecked' : 'radio_button_unchecked'
" "
:active="authName === 'API key'"
@click.native=" @click.native="
() => { () => {
authType = 'api-key' authType = 'api-key'
@@ -223,6 +228,7 @@
? 'radio_button_checked' ? 'radio_button_checked'
: 'radio_button_unchecked' : 'radio_button_unchecked'
" "
:active="addTo === 'Headers'"
:label="'Headers'" :label="'Headers'"
@click.native=" @click.native="
() => { () => {
@@ -237,6 +243,7 @@
? 'radio_button_checked' ? 'radio_button_checked'
: 'radio_button_unchecked' : 'radio_button_unchecked'
" "
:active="addTo === 'Query params'"
:label="'Query params'" :label="'Query params'"
@click.native=" @click.native="
() => { () => {

View File

@@ -69,11 +69,11 @@
{{ t("error.network_fail") }} {{ t("error.network_fail") }}
</span> </span>
<span <span
class="max-w-sm text-secondaryLight text-center mb-4 whitespace-normal" class="max-w-sm text-secondaryLight text-center mb-6 whitespace-normal"
> >
{{ t("helpers.network_fail") }} {{ t("helpers.network_fail") }}
</span> </span>
<AppInterceptor /> <AppInterceptor class="border border-dividerLight rounded" />
</div> </div>
<div <div
v-if="response.type === 'script_fail'" v-if="response.type === 'script_fail'"
@@ -89,7 +89,7 @@
{{ t("error.script_fail") }} {{ t("error.script_fail") }}
</span> </span>
<span <span
class="max-w-sm text-secondaryLight text-center mb-4 whitespace-normal" class="max-w-sm text-secondaryLight text-center mb-6 whitespace-normal"
> >
{{ t("helpers.script_fail") }} {{ t("helpers.script_fail") }}
</span> </span>

View File

@@ -16,15 +16,23 @@
</span> </span>
</template> </template>
<NuxtLink <NuxtLink
v-for="(locale, index) in $i18n.locales.filter( v-for="(locale, index) in $i18n.locales"
({ code }) => code !== $i18n.locale :key="`locale-${index}`"
)"
:key="`locale-${String(index)}`"
:to="switchLocalePath(locale.code)" :to="switchLocalePath(locale.code)"
@click="$refs.language.tippy().hide()" @click="language.tippy().hide()"
> >
<SmartItem :label="locale.name" /> <SmartItem
:label="locale.name"
:active-info-icon="$i18n.locale === locale.code"
:info-icon="$i18n.locale === locale.code ? 'done' : null"
/>
</NuxtLink> </NuxtLink>
</tippy> </tippy>
</span> </span>
</template> </template>
<script setup lang="ts">
import { ref } from "@nuxtjs/composition-api"
const language = ref<any | null>(null)
</script>

View File

@@ -22,10 +22,11 @@
:icon=" :icon="
size === active ? 'radio_button_checked' : 'radio_button_unchecked' size === active ? 'radio_button_checked' : 'radio_button_unchecked'
" "
:active="size === active"
@click.native=" @click.native="
() => { () => {
setActiveFont(size) setActiveFont(size)
$refs.fontSize.tippy().hide() fontSize.tippy().hide()
} }
" "
/> />
@@ -34,6 +35,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref } from "@nuxtjs/composition-api"
import { import {
HoppFontSizes, HoppFontSizes,
HoppFontSize, HoppFontSize,
@@ -46,6 +48,7 @@ const t = useI18n()
const fontSizes = HoppFontSizes const fontSizes = HoppFontSizes
const active = useSetting("FONT_SIZE") const active = useSetting("FONT_SIZE")
const fontSize = ref<any | null>(null)
const getFontSizeName = (size: HoppFontSize) => { const getFontSizeName = (size: HoppFontSize) => {
return t(`settings.font_size_${size}`) return t(`settings.font_size_${size}`)

View File

@@ -24,22 +24,22 @@
> >
<i <i
v-if="icon" v-if="icon"
class="opacity-75 material-icons"
:class="[ :class="[
label ? (reverse ? 'ml-4 opacity-75' : 'mr-4 opacity-75') : '', label ? (reverse ? 'ml-4' : 'mr-4') : '',
{ 'text-accent': active }, { 'text-accent': active },
]" ]"
class="material-icons"
> >
{{ icon }} {{ icon }}
</i> </i>
<SmartIcon <SmartIcon
v-if="svg" v-if="svg"
:name="svg" :name="svg"
class="opacity-75 svg-icons"
:class="[ :class="[
label ? (reverse ? 'ml-4 opacity-75' : 'mr-4 opacity-75') : '', label ? (reverse ? 'ml-4' : 'mr-4') : '',
{ 'text-accent': active }, { 'text-accent': active },
]" ]"
class="svg-icons"
/> />
</span> </span>
<SmartSpinner v-else class="mr-4 text-secondaryDark" /> <SmartSpinner v-else class="mr-4 text-secondaryDark" />

View File

@@ -1,16 +1,16 @@
<template> <template>
<label <div
class="cursor-pointer flex-nowrap transition inline-flex items-center justify-center group hover:text-secondaryDark" class="cursor-pointer flex flex-nowrap transition flex-1 items-center group hover:text-secondaryDark"
@click="$emit('change', value)"
> >
<input <span class="inline-flex mr-4">
type="radio" <i v-if="value === selected" class="text-accent material-icons">
:value="value" radio_button_checked
:checked="value === selected" </i>
class="appearance-none cursor-pointer mr-4 transition rounded-full h-4 w-4 border-2 border-divider group-hover:border-accentDark checked:border-4 checked:border-accent focus:outline-none" <i v-else class="material-icons">radio_button_unchecked</i>
@change="$emit('change', value)" </span>
/> <span class="font-semibold inline-flex">{{ label }}</span>
<span class="font-semibold transition">{{ label }}</span> </div>
</label>
</template> </template>
<script> <script>

View File

@@ -1,5 +1,5 @@
<template> <template>
<div class="flex flex-col space-y-4 items-start"> <div class="flex flex-col space-y-4">
<SmartRadio <SmartRadio
v-for="(radio, index) in radios" v-for="(radio, index) in radios"
:key="`radio-${index}`" :key="`radio-${index}`"

View File

@@ -3,12 +3,12 @@
class="cursor-pointer flex-nowrap transition inline-flex items-center justify-center group hover:text-secondaryDark" class="cursor-pointer flex-nowrap transition inline-flex items-center justify-center group hover:text-secondaryDark"
@click="$emit('change')" @click="$emit('change')"
> >
<label ref="toggle" class="toggle" :class="{ on: on }"> <span ref="toggle" class="toggle" :class="{ on: on }">
<span class="handle"></span> <span class="handle"></span>
</label> </span>
<label class="cursor-pointer font-semibold pl-0 align-middle"> <span class="cursor-pointer font-semibold pl-0 align-middle">
<slot></slot> <slot></slot>
</label> </span>
</div> </div>
</template> </template>

View File

@@ -15,16 +15,16 @@
> >
<i <i
v-if="icon" v-if="icon"
:class="label ? (reverse ? 'ml-4 opacity-75' : 'mr-4 opacity-75') : ''" class="opacity-75 material-icons"
class="material-icons" :class="label ? (reverse ? 'ml-4' : 'mr-4') : ''"
> >
{{ icon }} {{ icon }}
</i> </i>
<SmartIcon <SmartIcon
v-if="svg" v-if="svg"
:name="svg" :name="svg"
:class="label ? (reverse ? 'ml-4 opacity-75' : 'mr-4 opacity-75') : ''" class="opacity-75 svg-icons"
class="svg-icons" :class="label ? (reverse ? 'ml-4' : 'mr-4') : ''"
/> />
{{ label }} {{ label }}
</SmartLink> </SmartLink>

View File

@@ -111,6 +111,7 @@
? 'radio_button_checked' ? 'radio_button_checked'
: 'radio_button_unchecked' : 'radio_button_unchecked'
" "
:active="member.role === 'OWNER'"
@click.native=" @click.native="
() => { () => {
updateMemberRole(member.userID, 'OWNER') updateMemberRole(member.userID, 'OWNER')
@@ -125,6 +126,7 @@
? 'radio_button_checked' ? 'radio_button_checked'
: 'radio_button_unchecked' : 'radio_button_unchecked'
" "
:active="member.role === 'EDITOR'"
@click.native=" @click.native="
() => { () => {
updateMemberRole(member.userID, 'EDITOR') updateMemberRole(member.userID, 'EDITOR')
@@ -139,6 +141,7 @@
? 'radio_button_checked' ? 'radio_button_checked'
: 'radio_button_unchecked' : 'radio_button_unchecked'
" "
:active="member.role === 'VIEWER'"
@click.native=" @click.native="
() => { () => {
updateMemberRole(member.userID, 'VIEWER') updateMemberRole(member.userID, 'VIEWER')

View File

@@ -166,6 +166,7 @@
? 'radio_button_checked' ? 'radio_button_checked'
: 'radio_button_unchecked' : 'radio_button_unchecked'
" "
:active="invitee.value === 'OWNER'"
@click.native=" @click.native="
() => { () => {
updateNewInviteeRole(index, 'OWNER') updateNewInviteeRole(index, 'OWNER')
@@ -180,6 +181,7 @@
? 'radio_button_checked' ? 'radio_button_checked'
: 'radio_button_unchecked' : 'radio_button_unchecked'
" "
:active="invitee.value === 'EDITOR'"
@click.native=" @click.native="
() => { () => {
updateNewInviteeRole(index, 'EDITOR') updateNewInviteeRole(index, 'EDITOR')
@@ -194,6 +196,7 @@
? 'radio_button_checked' ? 'radio_button_checked'
: 'radio_button_unchecked' : 'radio_button_unchecked'
" "
:active="invitee.value === 'VIEWER'"
@click.native=" @click.native="
() => { () => {
updateNewInviteeRole(index, 'VIEWER') updateNewInviteeRole(index, 'VIEWER')

View File

@@ -214,7 +214,7 @@
"helpers": { "helpers": {
"authorization": "The authorization header will be automatically generated when you send the request.", "authorization": "The authorization header will be automatically generated when you send the request.",
"generate_documentation_first": "Generate documentation first", "generate_documentation_first": "Generate documentation first",
"network_fail": "Unable to reach the API endpoint. Check your network connection or turn on Proxy Interceptor and try again.", "network_fail": "Unable to reach the API endpoint. Check your network connection or select a different Interceptor and try again.",
"offline": "You seem to be offline. Data in this workspace might not be up to date.", "offline": "You seem to be offline. Data in this workspace might not be up to date.",
"offline_short": "You seem to be offline.", "offline_short": "You seem to be offline.",
"post_request_tests": "Test scripts are written in JavaScript, and are run after the response is received.", "post_request_tests": "Test scripts are written in JavaScript, and are run after the response is received.",