forked from jsnbuchanan/crowd-funder-for-time-pwa
fix(types): resolve notification system type safety issues
- Replace $notify any types with proper NotifyFunction interface - Import NotifyFunction type from utils/notify - Eliminate 5 TypeScript any type warnings - Improve type safety for notification system across components Reduces lint warnings from 25 to 20 by addressing high-impact, low-effort notification type issues. Maintains full functionality while improving code quality and IntelliSense support.
This commit is contained in:
56
src/App.vue
56
src/App.vue
@@ -28,8 +28,12 @@
|
|||||||
class="w-full max-w-sm mx-auto mb-3 overflow-hidden bg-slate-900/90 text-white rounded-lg shadow-md"
|
class="w-full max-w-sm mx-auto mb-3 overflow-hidden bg-slate-900/90 text-white rounded-lg shadow-md"
|
||||||
>
|
>
|
||||||
<div class="w-full px-4 py-3 overflow-hidden">
|
<div class="w-full px-4 py-3 overflow-hidden">
|
||||||
<h4 class="font-semibold text-ellipsis overflow-hidden">{{ notification.title }}</h4>
|
<h4 class="font-semibold text-ellipsis overflow-hidden">
|
||||||
<p class="text-sm text-ellipsis overflow-hidden">{{ notification.text }}</p>
|
{{ notification.title }}
|
||||||
|
</h4>
|
||||||
|
<p class="text-sm text-ellipsis overflow-hidden">
|
||||||
|
{{ notification.text }}
|
||||||
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -46,9 +50,15 @@
|
|||||||
></font-awesome>
|
></font-awesome>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="relative w-full pl-4 pr-8 py-2 text-slate-900 overflow-hidden">
|
<div
|
||||||
<h4 class="font-semibold text-ellipsis overflow-hidden">{{ notification.title }}</h4>
|
class="relative w-full pl-4 pr-8 py-2 text-slate-900 overflow-hidden"
|
||||||
<p class="text-sm text-ellipsis overflow-hidden">{{ notification.text }}</p>
|
>
|
||||||
|
<h4 class="font-semibold text-ellipsis overflow-hidden">
|
||||||
|
{{ notification.title }}
|
||||||
|
</h4>
|
||||||
|
<p class="text-sm text-ellipsis overflow-hidden">
|
||||||
|
{{ notification.text }}
|
||||||
|
</p>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
class="absolute top-2 right-2 px-0.5 py-0 rounded-full bg-slate-200 text-slate-600"
|
class="absolute top-2 right-2 px-0.5 py-0 rounded-full bg-slate-200 text-slate-600"
|
||||||
@@ -72,9 +82,15 @@
|
|||||||
></font-awesome>
|
></font-awesome>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="relative w-full pl-4 pr-8 py-2 text-emerald-900 overflow-hidden">
|
<div
|
||||||
<h4 class="font-semibold text-ellipsis overflow-hidden">{{ notification.title }}</h4>
|
class="relative w-full pl-4 pr-8 py-2 text-emerald-900 overflow-hidden"
|
||||||
<p class="text-sm text-ellipsis overflow-hidden">{{ notification.text }}</p>
|
>
|
||||||
|
<h4 class="font-semibold text-ellipsis overflow-hidden">
|
||||||
|
{{ notification.title }}
|
||||||
|
</h4>
|
||||||
|
<p class="text-sm text-ellipsis overflow-hidden">
|
||||||
|
{{ notification.text }}
|
||||||
|
</p>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
class="absolute top-2 right-2 px-0.5 py-0 rounded-full bg-emerald-200 text-emerald-600"
|
class="absolute top-2 right-2 px-0.5 py-0 rounded-full bg-emerald-200 text-emerald-600"
|
||||||
@@ -98,9 +114,15 @@
|
|||||||
></font-awesome>
|
></font-awesome>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="relative w-full pl-4 pr-8 py-2 text-amber-900 overflow-hidden">
|
<div
|
||||||
<h4 class="font-semibold text-ellipsis overflow-hidden">{{ notification.title }}</h4>
|
class="relative w-full pl-4 pr-8 py-2 text-amber-900 overflow-hidden"
|
||||||
<p class="text-sm text-ellipsis overflow-hidden">{{ notification.text }}</p>
|
>
|
||||||
|
<h4 class="font-semibold text-ellipsis overflow-hidden">
|
||||||
|
{{ notification.title }}
|
||||||
|
</h4>
|
||||||
|
<p class="text-sm text-ellipsis overflow-hidden">
|
||||||
|
{{ notification.text }}
|
||||||
|
</p>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
class="absolute top-2 right-2 px-0.5 py-0 rounded-full bg-amber-200 text-amber-600"
|
class="absolute top-2 right-2 px-0.5 py-0 rounded-full bg-amber-200 text-amber-600"
|
||||||
@@ -124,9 +146,15 @@
|
|||||||
></font-awesome>
|
></font-awesome>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="relative w-full pl-4 pr-8 py-2 text-rose-900 overflow-hidden">
|
<div
|
||||||
<h4 class="font-semibold text-ellipsis overflow-hidden">{{ notification.title }}</h4>
|
class="relative w-full pl-4 pr-8 py-2 text-rose-900 overflow-hidden"
|
||||||
<p class="text-sm text-ellipsis overflow-hidden">{{ notification.text }}</p>
|
>
|
||||||
|
<h4 class="font-semibold text-ellipsis overflow-hidden">
|
||||||
|
{{ notification.title }}
|
||||||
|
</h4>
|
||||||
|
<p class="text-sm text-ellipsis overflow-hidden">
|
||||||
|
{{ notification.text }}
|
||||||
|
</p>
|
||||||
|
|
||||||
<button
|
<button
|
||||||
class="absolute top-2 right-2 px-0.5 py-0 rounded-full bg-rose-200 text-rose-600"
|
class="absolute top-2 right-2 px-0.5 py-0 rounded-full bg-rose-200 text-rose-600"
|
||||||
|
|||||||
@@ -252,7 +252,7 @@ import { GiveRecordWithContactInfo } from "@/interfaces/give";
|
|||||||
import EntityIcon from "./EntityIcon.vue";
|
import EntityIcon from "./EntityIcon.vue";
|
||||||
import { isHiddenDid } from "../libs/endorserServer";
|
import { isHiddenDid } from "../libs/endorserServer";
|
||||||
import ProjectIcon from "./ProjectIcon.vue";
|
import ProjectIcon from "./ProjectIcon.vue";
|
||||||
import { createNotifyHelpers } from "@/utils/notify";
|
import { createNotifyHelpers, NotifyFunction } from "@/utils/notify";
|
||||||
import {
|
import {
|
||||||
NOTIFY_PERSON_HIDDEN,
|
NOTIFY_PERSON_HIDDEN,
|
||||||
NOTIFY_UNKNOWN_PERSON,
|
NOTIFY_UNKNOWN_PERSON,
|
||||||
@@ -273,7 +273,7 @@ export default class ActivityListItem extends Vue {
|
|||||||
|
|
||||||
isHiddenDid = isHiddenDid;
|
isHiddenDid = isHiddenDid;
|
||||||
notify!: ReturnType<typeof createNotifyHelpers>;
|
notify!: ReturnType<typeof createNotifyHelpers>;
|
||||||
$notify!: (notification: any, timeout?: number) => void;
|
$notify!: NotifyFunction;
|
||||||
|
|
||||||
created() {
|
created() {
|
||||||
this.notify = createNotifyHelpers(this.$notify);
|
this.notify = createNotifyHelpers(this.$notify);
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ import EntitySelectionStep from "../components/EntitySelectionStep.vue";
|
|||||||
import GiftDetailsStep from "../components/GiftDetailsStep.vue";
|
import GiftDetailsStep from "../components/GiftDetailsStep.vue";
|
||||||
import { PlanData } from "../interfaces/records";
|
import { PlanData } from "../interfaces/records";
|
||||||
import { PlatformServiceMixin } from "@/utils/PlatformServiceMixin";
|
import { PlatformServiceMixin } from "@/utils/PlatformServiceMixin";
|
||||||
import { createNotifyHelpers, TIMEOUTS } from "@/utils/notify";
|
import { createNotifyHelpers, TIMEOUTS, NotifyFunction } from "@/utils/notify";
|
||||||
import {
|
import {
|
||||||
NOTIFY_GIFT_ERROR_NEGATIVE_AMOUNT,
|
NOTIFY_GIFT_ERROR_NEGATIVE_AMOUNT,
|
||||||
NOTIFY_GIFT_ERROR_NO_DESCRIPTION,
|
NOTIFY_GIFT_ERROR_NO_DESCRIPTION,
|
||||||
@@ -98,7 +98,7 @@ import {
|
|||||||
mixins: [PlatformServiceMixin],
|
mixins: [PlatformServiceMixin],
|
||||||
})
|
})
|
||||||
export default class GiftedDialog extends Vue {
|
export default class GiftedDialog extends Vue {
|
||||||
$notify!: (notification: any, timeout?: number) => void;
|
$notify!: NotifyFunction;
|
||||||
notify!: ReturnType<typeof createNotifyHelpers>;
|
notify!: ReturnType<typeof createNotifyHelpers>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -282,7 +282,7 @@ import {
|
|||||||
NOTIFY_IMAGE_DIALOG_UNSUPPORTED_FORMAT,
|
NOTIFY_IMAGE_DIALOG_UNSUPPORTED_FORMAT,
|
||||||
createImageDialogCameraErrorMessage,
|
createImageDialogCameraErrorMessage,
|
||||||
} from "../constants/notifications";
|
} from "../constants/notifications";
|
||||||
import { createNotifyHelpers, TIMEOUTS } from "../utils/notify";
|
import { createNotifyHelpers, TIMEOUTS, NotifyFunction } from "../utils/notify";
|
||||||
|
|
||||||
const inputImageFileNameRef = ref<Blob>();
|
const inputImageFileNameRef = ref<Blob>();
|
||||||
|
|
||||||
@@ -291,7 +291,7 @@ const inputImageFileNameRef = ref<Blob>();
|
|||||||
mixins: [PlatformServiceMixin],
|
mixins: [PlatformServiceMixin],
|
||||||
})
|
})
|
||||||
export default class ImageMethodDialog extends Vue {
|
export default class ImageMethodDialog extends Vue {
|
||||||
$notify!: (notification: any, timeout?: number) => void;
|
$notify!: NotifyFunction;
|
||||||
$router!: Router;
|
$router!: Router;
|
||||||
notify = createNotifyHelpers(this.$notify);
|
notify = createNotifyHelpers(this.$notify);
|
||||||
|
|
||||||
|
|||||||
@@ -15,10 +15,15 @@ const TEST_USER_0_MNEMONIC =
|
|||||||
"rigid shrug mobile smart veteran half all pond toilet brave review universe ship congress found yard skate elite apology jar uniform subway slender luggage";
|
"rigid shrug mobile smart veteran half all pond toilet brave review universe ship congress found yard skate elite apology jar uniform subway slender luggage";
|
||||||
|
|
||||||
export async function testBecomeUser0() {
|
export async function testBecomeUser0() {
|
||||||
const [addr, privateHex, publicHex, deriPath] = deriveAddress(TEST_USER_0_MNEMONIC);
|
const [addr, privateHex, publicHex, deriPath] =
|
||||||
|
deriveAddress(TEST_USER_0_MNEMONIC);
|
||||||
|
|
||||||
const identity0 = newIdentifier(addr, publicHex, privateHex, deriPath);
|
const identity0 = newIdentifier(addr, publicHex, privateHex, deriPath);
|
||||||
await saveNewIdentity(identity0, TEST_USER_0_MNEMONIC, DEFAULT_ROOT_DERIVATION_PATH);
|
await saveNewIdentity(
|
||||||
|
identity0,
|
||||||
|
TEST_USER_0_MNEMONIC,
|
||||||
|
DEFAULT_ROOT_DERIVATION_PATH,
|
||||||
|
);
|
||||||
const platformService = await PlatformServiceFactory.getInstance();
|
const platformService = await PlatformServiceFactory.getInstance();
|
||||||
await platformService.updateDidSpecificSettings(identity0.did, {
|
await platformService.updateDidSpecificSettings(identity0.did, {
|
||||||
isRegistered: true,
|
isRegistered: true,
|
||||||
@@ -35,7 +40,8 @@ export async function testBecomeUser0() {
|
|||||||
* @throws Error if registration fails or database access fails
|
* @throws Error if registration fails or database access fails
|
||||||
*/
|
*/
|
||||||
export async function testServerRegisterUser() {
|
export async function testServerRegisterUser() {
|
||||||
const [addr, privateHex, publicHex, deriPath] = deriveAddress(TEST_USER_0_MNEMONIC);
|
const [addr, privateHex, publicHex, deriPath] =
|
||||||
|
deriveAddress(TEST_USER_0_MNEMONIC);
|
||||||
|
|
||||||
const identity0 = newIdentifier(addr, publicHex, privateHex, deriPath);
|
const identity0 = newIdentifier(addr, publicHex, privateHex, deriPath);
|
||||||
|
|
||||||
|
|||||||
@@ -143,7 +143,7 @@ import {
|
|||||||
QR_TIMEOUT_STANDARD,
|
QR_TIMEOUT_STANDARD,
|
||||||
QR_TIMEOUT_LONG,
|
QR_TIMEOUT_LONG,
|
||||||
} from "@/constants/notifications";
|
} from "@/constants/notifications";
|
||||||
import { createNotifyHelpers } from "../utils/notify";
|
import { createNotifyHelpers, NotifyFunction } from "../utils/notify";
|
||||||
|
|
||||||
interface QRScanResult {
|
interface QRScanResult {
|
||||||
rawValue?: string;
|
rawValue?: string;
|
||||||
@@ -191,7 +191,7 @@ interface IUserNameDialog {
|
|||||||
* @since 2024
|
* @since 2024
|
||||||
*/
|
*/
|
||||||
export default class ContactQRScanFull extends Vue {
|
export default class ContactQRScanFull extends Vue {
|
||||||
$notify!: (notification: any, timeout?: number) => void;
|
$notify!: NotifyFunction;
|
||||||
$router!: Router;
|
$router!: Router;
|
||||||
|
|
||||||
// Notification helper system
|
// Notification helper system
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ import {
|
|||||||
import { logger } from "../utils/logger";
|
import { logger } from "../utils/logger";
|
||||||
import { Account, AccountEncrypted } from "../db/tables/accounts";
|
import { Account, AccountEncrypted } from "../db/tables/accounts";
|
||||||
import { PlatformServiceMixin } from "@/utils/PlatformServiceMixin";
|
import { PlatformServiceMixin } from "@/utils/PlatformServiceMixin";
|
||||||
import { createNotifyHelpers, TIMEOUTS } from "@/utils/notify";
|
import { createNotifyHelpers, TIMEOUTS, NotifyFunction } from "@/utils/notify";
|
||||||
import {
|
import {
|
||||||
NOTIFY_ACCOUNT_DERIVATION_SUCCESS,
|
NOTIFY_ACCOUNT_DERIVATION_SUCCESS,
|
||||||
NOTIFY_ACCOUNT_DERIVATION_ERROR,
|
NOTIFY_ACCOUNT_DERIVATION_ERROR,
|
||||||
@@ -100,7 +100,7 @@ import {
|
|||||||
export default class ImportAccountView extends Vue {
|
export default class ImportAccountView extends Vue {
|
||||||
$route!: RouteLocationNormalizedLoaded;
|
$route!: RouteLocationNormalizedLoaded;
|
||||||
$router!: Router;
|
$router!: Router;
|
||||||
$notify!: (notification: any, timeout?: number) => void;
|
$notify!: NotifyFunction;
|
||||||
|
|
||||||
notify!: ReturnType<typeof createNotifyHelpers>;
|
notify!: ReturnType<typeof createNotifyHelpers>;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user