Skip to content

Commit

Permalink
refactor: better logic for type shapes
Browse files Browse the repository at this point in the history
  • Loading branch information
JoelJacobStephen committed Oct 6, 2023
1 parent 65656bb commit c915529
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 17 deletions.
12 changes: 1 addition & 11 deletions packages/hoppscotch-cli/src/types/request.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,7 @@ export const HoppEnvExportObject = z.object({
});

// Shape of the bulk environment export object that is exported from the app.
export const HoppBulkEnvExportObject = z.array(
z.object({
name: z.string(),
variables: z.array(
z.object({
key: z.string(),
value: z.string(),
})
),
})
);
export const HoppBulkEnvExportObject = z.array(HoppEnvExportObject);

export type HoppEnvs = {
global: HoppEnvPair[];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
role="menu"
@keyup.e="edit!.$el.click()"
@keyup.d="duplicate!.$el.click()"
@keyup.j="exportAsJson!.$el.click()"
@keyup.j="exportAsJsonEl!.$el.click()"
@keyup.delete="
!(environmentIndex === 'Global')
? deleteAction!.$el.click()
Expand Down Expand Up @@ -79,7 +79,7 @@
"
/>
<HoppSmartItem
ref="exportAsJson"
ref="exportAsJsonEl"
:icon="IconEdit"
:label="`${t('export.as_json')}`"
:shortcut="['J']"
Expand Down Expand Up @@ -161,7 +161,7 @@ const tippyActions = ref<TippyComponent | null>(null)
const options = ref<TippyComponent | null>(null)
const edit = ref<typeof HoppSmartItem>()
const duplicate = ref<typeof HoppSmartItem>()
const exportAsJson = ref<typeof HoppSmartItem>()
const exportAsJsonEl = ref<typeof HoppSmartItem>()
const deleteAction = ref<typeof HoppSmartItem>()
const removeEnvironment = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
role="menu"
@keyup.e="edit!.$el.click()"
@keyup.d="duplicate!.$el.click()"
@keyup.j="exportAsJson!.$el.click()"
@keyup.j="exportAsJsonEl!.$el.click()"
@keyup.delete="deleteAction!.$el.click()"
@keyup.escape="options!.tippy().hide()"
>
Expand Down Expand Up @@ -69,7 +69,7 @@
"
/>
<HoppSmartItem
ref="exportAsJson"
ref="exportAsJsonEl"
:icon="IconEdit"
:label="`${t('export.as_json')}`"
:shortcut="['J']"
Expand Down Expand Up @@ -149,7 +149,7 @@ const options = ref<TippyComponent | null>(null)
const edit = ref<typeof HoppSmartItem>()
const duplicate = ref<typeof HoppSmartItem>()
const deleteAction = ref<typeof HoppSmartItem>()
const exportAsJson = ref<typeof HoppSmartItem>()
const exportAsJsonEl = ref<typeof HoppSmartItem>()
const removeEnvironment = () => {
pipe(
Expand Down
1 change: 1 addition & 0 deletions packages/hoppscotch-sh-admin/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ declare module '@vue/runtime-core' {
HoppSmartModal: typeof import('@hoppscotch/ui')['HoppSmartModal']
HoppSmartPicture: typeof import('@hoppscotch/ui')['HoppSmartPicture']
HoppSmartSpinner: typeof import('@hoppscotch/ui')['HoppSmartSpinner']
HoppSmartTable: typeof import('@hoppscotch/ui')['HoppSmartTable']
IconLucideArrowLeft: typeof import('~icons/lucide/arrow-left')['default']
IconLucideChevronDown: typeof import('~icons/lucide/chevron-down')['default']
IconLucideInbox: typeof import('~icons/lucide/inbox')['default']
Expand Down

0 comments on commit c915529

Please sign in to comment.