Skip to content

Commit

Permalink
Replaced helpers by logitar-js. (#85)
Browse files Browse the repository at this point in the history
* Upgraded logitar-vue3-ui.

* Replaced helpers by logitar-js.
  • Loading branch information
Utar94 authored Apr 23, 2024
1 parent 9f1221b commit 362d069
Show file tree
Hide file tree
Showing 27 changed files with 66 additions and 188 deletions.
14 changes: 10 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"@vee-validate/i18n": "~4.9.6",
"@vee-validate/rules": "~4.9.6",
"bootstrap": "^5.3.3",
"logitar-vue3-ui": "^2.4.0",
"logitar-vue3-ui": "^2.5.1",
"pinia": "^2.1.7",
"pinia-plugin-persistedstate": "^3.2.1",
"vee-validate": "^4.9.6",
Expand Down
4 changes: 3 additions & 1 deletion src/api/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { stringUtils } from "logitar-js";

import type { ApiError, ApiResult, ApiVersion, Error as ErrorT, GraphQLRequest, GraphQLResponse } from "@/types/api";
import { combineURL, isAbsoluteURL } from "@/helpers/stringUtils";

const apiBaseUrl: string = import.meta.env.VITE_APP_API_BASE_URL ?? "";
const contentType: string = "Content-Type";
const { combineURL, isAbsoluteURL } = stringUtils;

async function execute<TData, TResult>(method: string, url: string, data?: TData): Promise<ApiResult<TResult>> {
let body: string | undefined = undefined;
Expand Down
5 changes: 3 additions & 2 deletions src/components/layout/AppNavbar.vue
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
<script setup lang="ts">
import { RouterLink } from "vue-router";
import { TarAvatar, parsingUtils } from "logitar-vue3-ui";
import { arrayUtils, stringUtils } from "logitar-js";
import { computed, watchEffect } from "vue";
import { setLocale } from "@vee-validate/i18n";
import { useI18n } from "vue-i18n";
import locales from "@/resources/locales.json";
import type { CurrentUser } from "@/types/account";
import type { Locale } from "@/types/i18n";
import { combineURL } from "@/helpers/stringUtils";
import { orderBy } from "@/helpers/arrayUtils";
import { useAccountStore } from "@/stores/account";
import { useI18nStore } from "@/stores/i18n";
const { combineURL } = stringUtils;
const { orderBy } = arrayUtils;
const { parseBoolean } = parsingUtils;
type Hyperlink = {
text?: string;
Expand Down
5 changes: 3 additions & 2 deletions src/components/shared/AppInput.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
<script setup lang="ts">
import { TarInput, inputUtils, parsingUtils, type InputOptions, type InputStatus } from "logitar-vue3-ui";
import { TarInput, inputUtils, type InputOptions, type InputStatus } from "logitar-vue3-ui";
import { computed, ref } from "vue";
import { nanoid } from "nanoid";
import { parsingUtils, stringUtils } from "logitar-js";
import { useField } from "vee-validate";
import { useI18n } from "vue-i18n";
import type { ShowStatus, ValidationListeners, ValidationRules, ValidationType } from "@/types/validation";
import { isNullOrWhiteSpace } from "@/helpers/stringUtils";
const { isDateTimeInput, isNumericInput, isTextualInput } = inputUtils;
const { isNullOrWhiteSpace } = stringUtils;
const { parseBoolean, parseNumber } = parsingUtils;
const { t } = useI18n();
Expand Down
4 changes: 3 additions & 1 deletion src/components/shared/DateTimeInput.vue
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
<script setup lang="ts">
import type { InputSize } from "logitar-vue3-ui";
import { dateUtils } from "logitar-js";
import AppInput from "./AppInput.vue";
import type { ValidationRules } from "@/types/validation";
import { toDateTimeLocal } from "@/helpers/dateUtils";
const { toDateTimeLocal } = dateUtils;
defineProps<{
describedBy?: string;
Expand Down
3 changes: 2 additions & 1 deletion src/components/todos/StatusSelect.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<script setup lang="ts">
import type { SelectOption } from "logitar-vue3-ui";
import { arrayUtils } from "logitar-js";
import { computed } from "vue";
import { useI18n } from "vue-i18n";
import AppSelect from "@/components/shared/AppSelect.vue";
import { orderBy } from "@/helpers/arrayUtils";
const { orderBy } = arrayUtils;
const { t } = useI18n();
defineProps<{
Expand Down
3 changes: 2 additions & 1 deletion src/components/users/AddressCountrySelect.vue
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
<script setup lang="ts">
import type { SelectOption } from "logitar-vue3-ui";
import { arrayUtils } from "logitar-js";
import { computed } from "vue";
import { useI18n } from "vue-i18n";
import AppSelect from "@/components/shared/AppSelect.vue";
import countries from "@/resources/countries.json";
import type { CountrySettings } from "@/types/settings";
import { orderBy } from "@/helpers/arrayUtils";
const { orderBy } = arrayUtils;
const { t } = useI18n();
defineProps<{
Expand Down
3 changes: 2 additions & 1 deletion src/components/users/AddressRegionSelect.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
<script setup lang="ts">
import type { SelectOption } from "logitar-vue3-ui";
import { arrayUtils } from "logitar-js";
import { computed } from "vue";
import { useI18n } from "vue-i18n";
import AppSelect from "@/components/shared/AppSelect.vue";
import type { CountrySettings } from "@/types/settings";
import { orderBy } from "@/helpers/arrayUtils";
const { orderBy } = arrayUtils;
const { t } = useI18n();
const props = defineProps<{
Expand Down
3 changes: 2 additions & 1 deletion src/components/users/ContactInformation.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script setup lang="ts">
import { TarButton } from "logitar-vue3-ui";
import { computed, ref, watch } from "vue";
import { stringUtils } from "logitar-js";
import { useForm } from "vee-validate";
import { useI18n } from "vue-i18n";
Expand All @@ -17,9 +18,9 @@ import countries from "@/resources/countries.json";
import type { AddressPayload, EmailPayload, PhonePayload } from "@/types/users";
import type { CountrySettings } from "@/types/settings";
import type { UserProfile } from "@/types/account";
import { isNullOrWhiteSpace } from "@/helpers/stringUtils";
import { saveProfile } from "@/api/account";
const { isNullOrWhiteSpace } = stringUtils;
const { t } = useI18n();
const props = defineProps<{
Expand Down
3 changes: 2 additions & 1 deletion src/components/users/GenderSelect.vue
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
<script setup lang="ts">
import type { SelectOption } from "logitar-vue3-ui";
import { arrayUtils } from "logitar-js";
import { computed } from "vue";
import { useI18n } from "vue-i18n";
import AppSelect from "@/components/shared/AppSelect.vue";
import { orderBy } from "@/helpers/arrayUtils";
const { orderBy } = arrayUtils;
const { rt, tm } = useI18n();
defineProps<{
Expand Down
4 changes: 3 additions & 1 deletion src/components/users/LocaleSelect.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<script setup lang="ts">
import type { SelectOption } from "logitar-vue3-ui";
import { arrayUtils } from "logitar-js";
import { computed } from "vue";
import AppSelect from "@/components/shared/AppSelect.vue";
import locales from "@/resources/locales.json";
import { orderBy } from "@/helpers/arrayUtils";
const { orderBy } = arrayUtils;
defineProps<{
modelValue?: string;
Expand Down
4 changes: 3 additions & 1 deletion src/components/users/TimeZoneSelect.vue
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<script setup lang="ts">
import type { SelectOption } from "logitar-vue3-ui";
import { arrayUtils } from "logitar-js";
import { computed } from "vue";
import AppSelect from "@/components/shared/AppSelect.vue";
import timeZones from "@/resources/timeZones.json";
import { orderBy } from "@/helpers/arrayUtils";
const { orderBy } = arrayUtils;
defineProps<{
modelValue?: string;
Expand Down
25 changes: 0 additions & 25 deletions src/helpers/arrayUtils.ts

This file was deleted.

11 changes: 0 additions & 11 deletions src/helpers/dateUtils.ts

This file was deleted.

18 changes: 0 additions & 18 deletions src/helpers/deviceUtils.ts

This file was deleted.

9 changes: 0 additions & 9 deletions src/helpers/objectUtils.ts

This file was deleted.

96 changes: 0 additions & 96 deletions src/helpers/stringUtils.ts

This file was deleted.

6 changes: 4 additions & 2 deletions src/stores/todo.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
import { arrayUtils, stringUtils } from "logitar-js";
import { defineStore } from "pinia";
import { nanoid } from "nanoid";
import { ref } from "vue";

import type { Actor } from "@/types/actor";
import type { CreateTodoPayload, ReplaceTodoPayload, SearchTodosPayload, Todo, TodoSortOption } from "@/types/todos";
import type { SearchResults } from "@/types/search";
import { cleanTrim, trim } from "@/helpers/stringUtils";
import { orderBy } from "@/helpers/arrayUtils";
import { useUserStore } from "./user";

const { cleanTrim, trim } = stringUtils;
const { orderBy } = arrayUtils;

function getCurrentActor(): Actor {
const user = useUserStore();
if (!user.currentUser) {
Expand Down
Loading

0 comments on commit 362d069

Please sign in to comment.