chore: minor ui improvements

This commit is contained in:
Liyas Thomas
2022-12-14 19:29:04 +05:30
parent 0d26d4cdbd
commit ba6069324f
15 changed files with 43 additions and 36 deletions

View File

@@ -99,6 +99,7 @@ declare module '@vue/runtime-core' {
HttpTests: typeof import('./components/http/Tests.vue')['default'] HttpTests: typeof import('./components/http/Tests.vue')['default']
HttpURLEncodedParams: typeof import('./components/http/URLEncodedParams.vue')['default'] HttpURLEncodedParams: typeof import('./components/http/URLEncodedParams.vue')['default']
IconLucideArrowLeft: typeof import('~icons/lucide/arrow-left')['default'] IconLucideArrowLeft: typeof import('~icons/lucide/arrow-left')['default']
IconLucideBrush: typeof import('~icons/lucide/brush')['default']
IconLucideCheckCircle: typeof import('~icons/lucide/check-circle')['default'] IconLucideCheckCircle: typeof import('~icons/lucide/check-circle')['default']
IconLucideChevronRight: typeof import('~icons/lucide/chevron-right')['default'] IconLucideChevronRight: typeof import('~icons/lucide/chevron-right')['default']
IconLucideGlobe: typeof import('~icons/lucide/globe')['default'] IconLucideGlobe: typeof import('~icons/lucide/globe')['default']
@@ -107,6 +108,7 @@ declare module '@vue/runtime-core' {
IconLucideLayers: typeof import('~icons/lucide/layers')['default'] IconLucideLayers: typeof import('~icons/lucide/layers')['default']
IconLucideLoader: typeof import('~icons/lucide/loader')['default'] IconLucideLoader: typeof import('~icons/lucide/loader')['default']
IconLucideMinus: typeof import('~icons/lucide/minus')['default'] IconLucideMinus: typeof import('~icons/lucide/minus')['default']
IconLucideRss: typeof import('~icons/lucide/rss')['default']
IconLucideSearch: typeof import('~icons/lucide/search')['default'] IconLucideSearch: typeof import('~icons/lucide/search')['default']
IconLucideUser: typeof import('~icons/lucide/user')['default'] IconLucideUser: typeof import('~icons/lucide/user')['default']
IconLucideUsers: typeof import('~icons/lucide/users')['default'] IconLucideUsers: typeof import('~icons/lucide/users')['default']
@@ -119,7 +121,6 @@ declare module '@vue/runtime-core' {
LensesRenderersRawLensRenderer: typeof import('./components/lenses/renderers/RawLensRenderer.vue')['default'] LensesRenderersRawLensRenderer: typeof import('./components/lenses/renderers/RawLensRenderer.vue')['default']
LensesRenderersXMLLensRenderer: typeof import('./components/lenses/renderers/XMLLensRenderer.vue')['default'] LensesRenderersXMLLensRenderer: typeof import('./components/lenses/renderers/XMLLensRenderer.vue')['default']
LensesResponseBodyRenderer: typeof import('./components/lenses/ResponseBodyRenderer.vue')['default'] LensesResponseBodyRenderer: typeof import('./components/lenses/ResponseBodyRenderer.vue')['default']
Newcollections: typeof import('./components/newcollections/index.vue')['default']
ProfilePicture: typeof import('./components/profile/Picture.vue')['default'] ProfilePicture: typeof import('./components/profile/Picture.vue')['default']
ProfileShortcode: typeof import('./components/profile/Shortcode.vue')['default'] ProfileShortcode: typeof import('./components/profile/Shortcode.vue')['default']
RealtimeCommunication: typeof import('./components/realtime/Communication.vue')['default'] RealtimeCommunication: typeof import('./components/realtime/Communication.vue')['default']

View File

@@ -194,6 +194,7 @@
:show="showDeveloperOptions" :show="showDeveloperOptions"
@hide-modal="showDeveloperOptions = false" @hide-modal="showDeveloperOptions = false"
/> />
<FirebaseLogin :show="showLogin" @hide-modal="showLogin = false" />
</div> </div>
</template> </template>
@@ -231,6 +232,7 @@ const t = useI18n()
const showShortcuts = ref(false) const showShortcuts = ref(false)
const showShare = ref(false) const showShare = ref(false)
const showDeveloperOptions = ref(false) const showDeveloperOptions = ref(false)
const showLogin = ref(false)
defineActionHandler("flyouts.keybinds.toggle", () => { defineActionHandler("flyouts.keybinds.toggle", () => {
showShortcuts.value = !showShortcuts.value showShortcuts.value = !showShortcuts.value
@@ -240,6 +242,10 @@ defineActionHandler("modals.share.toggle", () => {
showShare.value = !showShare.value showShare.value = !showShare.value
}) })
defineActionHandler("modals.login.toggle", () => {
showLogin.value = !showLogin.value
})
const EXPAND_NAVIGATION = useSetting("EXPAND_NAVIGATION") const EXPAND_NAVIGATION = useSetting("EXPAND_NAVIGATION")
const SIDEBAR = useSetting("SIDEBAR") const SIDEBAR = useSetting("SIDEBAR")
const ZEN_MODE = useSetting("ZEN_MODE") const ZEN_MODE = useSetting("ZEN_MODE")

View File

@@ -42,12 +42,12 @@
:label="t('header.save_workspace')" :label="t('header.save_workspace')"
filled filled
class="hidden md:flex" class="hidden md:flex"
@click="showLogin = true" @click="invokeAction('modals.login.toggle')"
/> />
<ButtonPrimary <ButtonPrimary
v-if="currentUser === null" v-if="currentUser === null"
:label="t('header.login')" :label="t('header.login')"
@click="showLogin = true" @click="invokeAction('modals.login.toggle')"
/> />
<div v-else class="inline-flex items-center space-x-2"> <div v-else class="inline-flex items-center space-x-2">
<ButtonPrimary <ButtonPrimary
@@ -150,7 +150,6 @@
</div> </div>
</header> </header>
<AppAnnouncement v-if="!network.isOnline" /> <AppAnnouncement v-if="!network.isOnline" />
<FirebaseLogin :show="showLogin" @hide-modal="showLogin = false" />
<TeamsModal :show="showTeamsModal" @hide-modal="showTeamsModal = false" /> <TeamsModal :show="showTeamsModal" @hide-modal="showTeamsModal = false" />
</div> </div>
</template> </template>
@@ -181,7 +180,6 @@ const t = useI18n()
const showInstallButton = computed(() => !!pwaDefferedPrompt.value) const showInstallButton = computed(() => !!pwaDefferedPrompt.value)
const showLogin = ref(false)
const showTeamsModal = ref(false) const showTeamsModal = ref(false)
const breakpoints = useBreakpoints(breakpointsTailwind) const breakpoints = useBreakpoints(breakpointsTailwind)

View File

@@ -76,10 +76,10 @@ type PaneEvent = {
size: number size: number
} }
const PANE_SIDEBAR_SIZE = ref(25) const PANE_MAIN_SIZE = ref(74)
const PANE_MAIN_SIZE = ref(75) const PANE_SIDEBAR_SIZE = ref(26)
const PANE_MAIN_TOP_SIZE = ref(45) const PANE_MAIN_TOP_SIZE = ref(42)
const PANE_MAIN_BOTTOM_SIZE = ref(65) const PANE_MAIN_BOTTOM_SIZE = ref(58)
if (!COLUMN_LAYOUT.value) { if (!COLUMN_LAYOUT.value) {
PANE_MAIN_TOP_SIZE.value = 50 PANE_MAIN_TOP_SIZE.value = 50

View File

@@ -12,7 +12,6 @@
<SmartTab <SmartTab
:id="'team-collections'" :id="'team-collections'"
:label="`${t('collection.team_collections')}`" :label="`${t('collection.team_collections')}`"
:disabled="!currentUser"
> >
<SmartIntersection @intersecting="onTeamSelectIntersect"> <SmartIntersection @intersecting="onTeamSelectIntersect">
<tippy <tippy
@@ -78,7 +77,7 @@
<script setup lang="ts"> <script setup lang="ts">
import IconUsers from "~icons/lucide/users" import IconUsers from "~icons/lucide/users"
import IconDone from "~icons/lucide/check" import IconDone from "~icons/lucide/check"
import { ref, watch } from "vue" import { nextTick, ref, watch } from "vue"
import { GetMyTeamsQuery, Team } from "~/helpers/backend/graphql" import { GetMyTeamsQuery, Team } from "~/helpers/backend/graphql"
import { currentUserInfo$ } from "~/helpers/teams/BackendUserInfo" import { currentUserInfo$ } from "~/helpers/teams/BackendUserInfo"
import TeamListAdapter from "~/helpers/teams/TeamListAdapter" import TeamListAdapter from "~/helpers/teams/TeamListAdapter"
@@ -86,6 +85,7 @@ import { useReadonlyStream } from "@composables/stream"
import { onLoggedIn } from "@composables/auth" import { onLoggedIn } from "@composables/auth"
import { useI18n } from "@composables/i18n" import { useI18n } from "@composables/i18n"
import { useLocalState } from "~/newstore/localstate" import { useLocalState } from "~/newstore/localstate"
import { invokeAction } from "~/helpers/actions"
type TeamData = GetMyTeamsQuery["myTeams"][number] type TeamData = GetMyTeamsQuery["myTeams"][number]
@@ -153,7 +153,10 @@ const updateSelectedTeam = (team: TeamData | undefined) => {
emit("update-selected-team", team) emit("update-selected-team", team)
} }
watch(selectedCollectionTab, (newValue: string) => { watch(selectedCollectionTab, (newValue: CollectionTabs) => {
updateCollectionsType(newValue) if (newValue === "team-collections" && !currentUser.value) {
invokeAction("modals.login.toggle")
nextTick(() => (selectedCollectionTab.value = "my-collections"))
} else updateCollectionsType(newValue)
}) })
</script> </script>

View File

@@ -12,7 +12,6 @@
<SmartTab <SmartTab
:id="'team-environments'" :id="'team-environments'"
:label="`${t('environment.team_environments')}`" :label="`${t('environment.team_environments')}`"
:disabled="!currentUser"
> >
<SmartIntersection @intersecting="onTeamSelectIntersect"> <SmartIntersection @intersecting="onTeamSelectIntersect">
<tippy <tippy
@@ -76,7 +75,7 @@
</template> </template>
<script setup lang="ts"> <script setup lang="ts">
import { ref, watch } from "vue" import { nextTick, ref, watch } from "vue"
import { GetMyTeamsQuery } from "~/helpers/backend/graphql" import { GetMyTeamsQuery } from "~/helpers/backend/graphql"
import { onLoggedIn } from "@composables/auth" import { onLoggedIn } from "@composables/auth"
import { currentUserInfo$ } from "~/helpers/teams/BackendUserInfo" import { currentUserInfo$ } from "~/helpers/teams/BackendUserInfo"
@@ -86,6 +85,7 @@ import { useLocalState } from "~/newstore/localstate"
import { useI18n } from "@composables/i18n" import { useI18n } from "@composables/i18n"
import IconDone from "~icons/lucide/check" import IconDone from "~icons/lucide/check"
import IconUsers from "~icons/lucide/users" import IconUsers from "~icons/lucide/users"
import { invokeAction } from "~/helpers/actions"
const t = useI18n() const t = useI18n()
@@ -156,6 +156,9 @@ const updateSelectedTeam = (team: SelectedTeam) => {
} }
watch(selectedEnvironmentTab, (newValue: EnvironmentTabs) => { watch(selectedEnvironmentTab, (newValue: EnvironmentTabs) => {
updateEnvironmentType(newValue) if (newValue === "team-environments" && !currentUser.value) {
invokeAction("modals.login.toggle")
nextTick(() => (selectedEnvironmentTab.value = "my-environments"))
} else updateEnvironmentType(newValue)
}) })
</script> </script>

View File

@@ -8,7 +8,6 @@
interactive interactive
trigger="click" trigger="click"
theme="popover" theme="popover"
arrow
:on-shown="() => tippyActions!.focus()" :on-shown="() => tippyActions!.focus()"
> >
<span <span
@@ -69,7 +68,7 @@
</div> </div>
</template> </template>
</tippy> </tippy>
<tippy v-else interactive trigger="click" theme="popover" arrow> <tippy v-else interactive trigger="click" theme="popover">
<span <span
v-tippy="{ theme: 'tooltip' }" v-tippy="{ theme: 'tooltip' }"
:title="`${t('environment.select')}`" :title="`${t('environment.select')}`"

View File

@@ -24,7 +24,6 @@
interactive interactive
trigger="click" trigger="click"
theme="popover" theme="popover"
arrow
:on-shown="() => tippyActions!.focus()" :on-shown="() => tippyActions!.focus()"
> >
<ButtonSecondary <ButtonSecondary

View File

@@ -34,12 +34,10 @@
/> />
</div> </div>
</div> </div>
<div <div v-if="teamDetails.loading" class="border rounded border-divider">
v-if="teamDetails.loading" <div class="flex items-center justify-center p-4">
class="flex flex-col items-center justify-center" <SmartSpinner />
> </div>
<SmartSpinner class="mb-4" />
<span class="text-secondaryLight">{{ t("state.loading") }}</span>
</div> </div>
<div <div
v-if=" v-if="

View File

@@ -37,6 +37,7 @@ export type HoppAction =
| "response.preview.toggle" // Toggle response preview | "response.preview.toggle" // Toggle response preview
| "response.file.download" // Download response as file | "response.file.download" // Download response as file
| "response.copy" // Copy response to clipboard | "response.copy" // Copy response to clipboard
| "modals.login.toggle" // Login to Hoppscotch
/** /**
* Defines the arguments, if present for a given type that is required to be passed on * Defines the arguments, if present for a given type that is required to be passed on

View File

@@ -47,6 +47,7 @@ export const baseTheme = EditorView.theme({
fontFamily: "var(--font-mono)", fontFamily: "var(--font-mono)",
color: "var(--secondary-dark-color)", color: "var(--secondary-dark-color)",
backgroundColor: "transparent", backgroundColor: "transparent",
height: "100%",
}, },
".cm-cursor": { ".cm-cursor": {
borderColor: "var(--secondary-color)", borderColor: "var(--secondary-color)",

View File

@@ -56,8 +56,8 @@ export const bindings: {
"alt-q": "navigation.jump.graphql", "alt-q": "navigation.jump.graphql",
"alt-w": "navigation.jump.realtime", "alt-w": "navigation.jump.realtime",
"alt-d": "navigation.jump.documentation", "alt-d": "navigation.jump.documentation",
"alt-m": "navigation.jump.profile",
"alt-s": "navigation.jump.settings", "alt-s": "navigation.jump.settings",
"alt-m": "navigation.jump.profile",
"ctrl-shift-p": "response.preview.toggle", "ctrl-shift-p": "response.preview.toggle",
"ctrl-j": "response.file.download", "ctrl-j": "response.file.download",
"ctrl-.": "response.copy", "ctrl-.": "response.copy",

View File

@@ -26,11 +26,11 @@ export function createHoppApp(el: string | Element) {
app.mount(el) app.mount(el)
console.info( console.info(
"%cWe ❤︎ open source!", "%cWE ♥️ OPEN SOURCE",
"background-color:white;padding:8px 16px;border-radius:8px;font-size:32px;color:red;" "margin:8px 0;font-family:Inter;font-weight:600;font-size:60px;color:violet;"
) )
console.info( console.info(
"%cContribute: https://github.com/hoppscotch/hoppscotch", "%cContribute: https://github.com/hoppscotch/hoppscotch",
"background-color:black;padding:4px 8px;border-radius:8px;font-size:16px;color:white;" "margin:8px 0;font-family:Inter;font-weight:500;font-size:24px;color:violet;"
) )
} }

View File

@@ -27,7 +27,7 @@
<ButtonPrimary <ButtonPrimary
:label="t('auth.login_to_hoppscotch')" :label="t('auth.login_to_hoppscotch')"
class="mt-8" class="mt-8"
@click="showLogin = true" @click="invokeAction('modals.login.toggle')"
/> />
</div> </div>
<div v-else class="flex flex-col items-center justify-center flex-1 p-4"> <div v-else class="flex flex-col items-center justify-center flex-1 p-4">
@@ -138,7 +138,6 @@
to="/" to="/"
/> />
</div> </div>
<FirebaseLogin :show="showLogin" @hide-modal="showLogin = false" />
</div> </div>
</template> </template>
@@ -163,6 +162,7 @@ import { useReadonlyStream } from "@composables/stream"
import { useToast } from "@composables/toast" import { useToast } from "@composables/toast"
import { useI18n } from "~/composables/i18n" import { useI18n } from "~/composables/i18n"
import IconHome from "~icons/lucide/home" import IconHome from "~icons/lucide/home"
import { invokeAction } from "~/helpers/actions"
type GetInviteDetailsError = type GetInviteDetailsError =
| "team_invite/not_valid_viewer" | "team_invite/not_valid_viewer"
@@ -214,12 +214,12 @@ export default defineComponent({
toast: useToast(), toast: useToast(),
t: useI18n(), t: useI18n(),
IconHome, IconHome,
invokeAction,
} }
}, },
data() { data() {
return { return {
invalidLink: false, invalidLink: false,
showLogin: false,
loading: false, loading: false,
revokedLink: false, revokedLink: false,
inviteID: "", inviteID: "",

View File

@@ -24,7 +24,7 @@
<ButtonPrimary <ButtonPrimary
:label="t('auth.login')" :label="t('auth.login')"
class="mb-4" class="mb-4"
@click="showLogin = true" @click="invokeAction('modals.login.toggle')"
/> />
</div> </div>
<div v-else class="space-y-8"> <div v-else class="space-y-8">
@@ -285,7 +285,6 @@
</div> </div>
</div> </div>
</div> </div>
<FirebaseLogin :show="showLogin" @hide-modal="showLogin = false" />
</div> </div>
</template> </template>
@@ -317,6 +316,7 @@ import { deleteShortcode as backendDeleteShortcode } from "~/helpers/backend/mut
import IconVerified from "~icons/lucide/verified" import IconVerified from "~icons/lucide/verified"
import IconSettings from "~icons/lucide/settings" import IconSettings from "~icons/lucide/settings"
import IconHelpCircle from "~icons/lucide/help-circle" import IconHelpCircle from "~icons/lucide/help-circle"
import { invokeAction } from "~/helpers/actions"
type ProfileTabs = "sync" | "teams" type ProfileTabs = "sync" | "teams"
@@ -330,8 +330,6 @@ usePageHead({
title: computed(() => t("navigation.profile")), title: computed(() => t("navigation.profile")),
}) })
const showLogin = ref(false)
const SYNC_COLLECTIONS = useSetting("syncCollections") const SYNC_COLLECTIONS = useSetting("syncCollections")
const SYNC_ENVIRONMENTS = useSetting("syncEnvironments") const SYNC_ENVIRONMENTS = useSetting("syncEnvironments")
const SYNC_HISTORY = useSetting("syncHistory") const SYNC_HISTORY = useSetting("syncHistory")