Skip to content

Commit

Permalink
Merge pull request #290 from letehaha/fix/small-ui-fixes
Browse files Browse the repository at this point in the history
Fix small UI issues
  • Loading branch information
letehaha committed Jan 28, 2024
2 parents 810f17e + cbb9f3b commit 4b71cb1
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"scripts": {
"build": "vue-tsc --noEmit && vite build",
"lint": "eslint -c ./.eslintrc.cjs --ignore-path ./.eslintignore .",
"dev": "vite",
"dev": "vite --host",
"prod": "vite --mode production",
"docker-build": "docker build . -t letehaha/budget-tracker-fe",
"docker-push": "docker push letehaha/budget-tracker-fe",
Expand Down
1 change: 1 addition & 0 deletions src/common/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export * from "./color-theme";
export * from "./meta-viewport-max-scale";
27 changes: 27 additions & 0 deletions src/common/utils/meta-viewport-max-scale.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
export const patchMetaViewportMaxScaleForiOS = () => {
const addMaximumScaleToMetaViewport = () => {
const el = document.querySelector("meta[name=viewport]");

if (el !== null) {
let content = el.getAttribute("content");
const re = /maximum-scale=[0-9.]+/g;

if (re.test(content)) {
content = content.replace(re, "maximum-scale=1.0");
} else {
content = [content, "maximum-scale=1.0"].join(", ");
}

el.setAttribute("content", content);
}
};

const disableIosTextFieldZoom = addMaximumScaleToMetaViewport;

// https://stackoverflow.com/questions/9038625/detect-if-device-is-ios/9039885#9039885
const checkIsIOS = () => /iPad|iPhone|iPod/.test(navigator.userAgent);

if (checkIsIOS()) {
disableIosTextFieldZoom();
}
};
6 changes: 5 additions & 1 deletion src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,16 @@ import { VueQueryPlugin } from "@tanstack/vue-query";
import { router } from "@/routes";
import { clickOutside, nodeResizeObserver } from "@/directives";
import { store } from "@/stores/setup";
import { identifyCurrentTheme } from "@/common/utils";
import {
identifyCurrentTheme,
patchMetaViewportMaxScaleForiOS,
} from "@/common/utils";
import App from "./app.vue";
import "@/styles/index.scss";
import "./registerServiceWorker";

identifyCurrentTheme();
patchMetaViewportMaxScaleForiOS();

const app = createApp(App);

Expand Down
4 changes: 2 additions & 2 deletions src/pages/account/components/header.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const updateAccount = async () => {

<template>
<CardHeader>
<div class="flex items-start justify-between">
<div class="flex flex-wrap items-start justify-between">
<p class="flex items-center gap-2">
<span class="text-xl">
{{ account.name }}
Expand Down Expand Up @@ -91,7 +91,7 @@ const updateAccount = async () => {
</Popover.PopoverContent>
</Popover.Popover>
</p>
<div class="flex items-end gap-2">
<div class="flex flex-wrap items-end justify-start gap-2 ml-auto">
<span
v-if="account.currencyId !== baseCurrency.currencyId"
class="text-white text-opacity-50"
Expand Down

0 comments on commit 4b71cb1

Please sign in to comment.