refactor: remove icons from toast

This commit is contained in:
liyasthomas
2021-11-19 21:13:58 +05:30
parent cad8f3e856
commit 26429466e9
58 changed files with 156 additions and 425 deletions

View File

@@ -1,5 +1,5 @@
<template>
<SmartModal v-if="show" :title="$t('team.new').toString()" @close="hideModal">
<SmartModal v-if="show" :title="$t('team.new')" @close="hideModal">
<template #body>
<div class="flex flex-col px-2">
<input
@@ -19,12 +19,9 @@
</template>
<template #footer>
<span>
<ButtonPrimary
:label="$t('action.save').toString()"
@click.native="addNewTeam"
/>
<ButtonPrimary :label="$t('action.save')" @click.native="addNewTeam" />
<ButtonSecondary
:label="$t('action.cancel').toString()"
:label="$t('action.cancel')"
@click.native="hideModal"
/>
</span>
@@ -66,9 +63,7 @@ const addNewTeam = () =>
(err) => {
// err is of type "invalid_name" | GQLError<Err>
if (err === "invalid_name") {
$toast.error(t("team.name_length_insufficient").toString(), {
icon: "error_outline",
})
$toast.error(`${t("team.name_length_insufficient")}`)
} else {
// Handle GQL errors (use err obj)
}

View File

@@ -361,13 +361,9 @@ const removeExistingTeamMember = async (userID: string) => {
props.editingTeamID
)()
if (E.isLeft(removeTeamMemberResult)) {
$toast.error(t("error.something_went_wrong"), {
icon: "error",
})
$toast.error(`${t("error.something_went_wrong")}`)
} else {
$toast.success(t("team.member_removed"), {
icon: "done",
})
$toast.success(`${t("team.member_removed")}`)
}
}
@@ -379,9 +375,7 @@ const saveTeam = async () => {
name.value
)()
if (E.isLeft(updateTeamNameResult)) {
$toast.error(t("error.something_went_wrong"), {
icon: "error",
})
$toast.error(`${t("error.something_went_wrong")}`)
} else {
roleUpdates.value.forEach(async (update) => {
const updateMemberRoleResult = await updateTeamMemberRole(
@@ -390,26 +384,18 @@ const saveTeam = async () => {
update.role
)()
if (E.isLeft(updateMemberRoleResult)) {
$toast.error(t("error.something_went_wrong"), {
icon: "error",
})
$toast.error(`${t("error.something_went_wrong")}`)
console.error(updateMemberRoleResult.left.error)
}
})
}
hideModal()
$toast.success(t("team.saved"), {
icon: "done",
})
$toast.success(`${t("team.saved")}`)
} else {
return $toast.error(t("team.name_length_insufficient"), {
icon: "error_outline",
})
return $toast.error(`${t("team.name_length_insufficient")}`)
}
} else {
return $toast.error(t("empty.team_name"), {
icon: "error_outline",
})
return $toast.error(`${t("empty.team_name")}`)
}
}

View File

@@ -491,13 +491,9 @@ watch(
const removeInvitee = async (id: string) => {
const result = await revokeTeamInvitation(id)()
if (E.isLeft(result)) {
$toast.error(`${t("error.something_went_wrong")}`, {
icon: "error_outline",
})
$toast.error(`${t("error.something_went_wrong")}`)
} else {
$toast.success(`${t("team.member_removed")}`, {
icon: "person",
})
$toast.success(`${t("team.member_removed")}`)
}
}
@@ -557,9 +553,7 @@ const sendInvites = async () => {
if (O.isNone(validationResult)) {
// Error handling for no validation
$toast.error(`${t("error.incorrect_email")}`, {
icon: "error_outline",
})
$toast.error(`${t("error.incorrect_email")}`)
return
}

View File

@@ -44,7 +44,7 @@
v-if="team.myRole === 'OWNER'"
svg="edit"
class="rounded-none"
:label="$t('action.edit').toString()"
:label="$t('action.edit')"
@click.native="
() => {
$emit('edit-team')
@@ -75,7 +75,7 @@
<SmartItem
v-if="team.myRole === 'OWNER'"
svg="edit"
:label="$t('action.edit').toString()"
:label="$t('action.edit')"
@click.native="
() => {
$emit('edit-team')
@@ -87,7 +87,7 @@
v-if="team.myRole === 'OWNER'"
svg="trash-2"
color="red"
:label="$t('action.delete').toString()"
:label="$t('action.delete')"
@click.native="
() => {
deleteTeam()
@@ -98,7 +98,7 @@
<SmartItem
v-if="!(team.myRole === 'OWNER' && team.ownersCount == 1)"
svg="trash"
:label="$t('team.exit').toString()"
:label="$t('team.exit')"
@click.native="
() => {
exitTeam()
@@ -150,22 +150,18 @@ const {
const t = i18n.t.bind(i18n)
const deleteTeam = () => {
if (!confirm(t("confirm.remove_team").toString())) return
if (!confirm(`${t("confirm.remove_team")}`)) return
pipe(
backendDeleteTeam(props.teamID),
TE.match(
(err) => {
// TODO: Better errors ? We know the possible errors now
$toast.error(t("error.something_went_wrong").toString(), {
icon: "error_outline",
})
$toast.error(`${t("error.something_went_wrong")}`)
console.error(err)
},
() => {
$toast.success(t("team.deleted").toString(), {
icon: "done",
})
$toast.success(`${t("team.deleted")}`)
}
)
)() // Tasks (and TEs) are lazy, so call the function returned
@@ -179,23 +175,17 @@ const exitTeam = () => {
TE.match(
(err) => {
// TODO: Better errors ?
$toast.error(t("error.something_went_wrong").toString(), {
icon: "error_outline",
})
$toast.error(`${t("error.something_went_wrong")}`)
console.error(err)
},
() => {
$toast.success(t("team.left").toString(), {
icon: "done",
})
$toast.success(`${t("team.left")}`)
}
)
)() // Tasks (and TEs) are lazy, so call the function returned
}
const noPermission = () => {
$toast.error(t("profile.no_permission").toString(), {
icon: "error_outline",
})
$toast.error(`${t("profile.no_permission")}`)
}
</script>