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

@@ -47,9 +47,7 @@ export default defineComponent({
methods: {
addNewCollection() {
if (!this.name) {
this.$toast.error(this.$t("collection.invalid_name"), {
icon: "error_outline",
})
this.$toast.error(this.$t("collection.invalid_name"))
return
}
this.$emit("submit", this.name)

View File

@@ -51,9 +51,7 @@ export default defineComponent({
methods: {
addFolder() {
if (!this.name) {
this.$toast.error(this.$t("folder.invalid_name"), {
icon: "error_outline",
})
this.$toast.error(this.$t("folder.invalid_name"))
return
}
this.$emit("add-folder", {

View File

@@ -48,9 +48,7 @@ export default defineComponent({
methods: {
saveCollection() {
if (!this.name) {
this.$toast.error(this.$t("collection.invalid_name"), {
icon: "error_outline",
})
this.$toast.error(this.$t("collection.invalid_name"))
return
}
this.$emit("submit", this.name)

View File

@@ -48,9 +48,7 @@ export default defineComponent({
methods: {
editFolder() {
if (!this.name) {
this.$toast.error(this.$t("folder.invalid_name"), {
icon: "error_outline",
})
this.$toast.error(this.$t("folder.invalid_name"))
return
}
this.$emit("submit", this.name)

View File

@@ -47,9 +47,7 @@ export default defineComponent({
methods: {
saveRequest() {
if (!this.requestUpdateData.name) {
this.$toast.error(this.$t("request.invalid_name"), {
icon: "error_outline",
})
this.$toast.error(this.$t("request.invalid_name"))
return
}
this.$emit("submit", this.requestUpdateData)

View File

@@ -229,15 +229,11 @@ export default defineComponent({
}
)
.then((res) => {
this.$toast.success(this.$t("export.gist_created"), {
icon: "done",
})
this.$toast.success(this.$t("export.gist_created"))
window.open(res.html_url)
})
.catch((e) => {
this.$toast.error(this.$t("error.something_went_wrong"), {
icon: "error_outline",
})
this.$toast.error(this.$t("error.something_went_wrong"))
console.error(e)
})
},
@@ -415,23 +411,17 @@ export default defineComponent({
a.download = `${url.split("/").pop().split("#")[0].split("?")[0]}.json`
document.body.appendChild(a)
a.click()
this.$toast.success(this.$t("state.download_started"), {
icon: "downloading",
})
this.$toast.success(this.$t("state.download_started"))
setTimeout(() => {
document.body.removeChild(a)
URL.revokeObjectURL(url)
}, 1000)
},
fileImported() {
this.$toast.success(this.$t("state.file_imported"), {
icon: "folder_shared",
})
this.$toast.success(this.$t("state.file_imported"))
},
failedImport() {
this.$toast.error(this.$t("import.failed"), {
icon: "error_outline",
})
this.$toast.error(this.$t("import.failed"))
},
parsePostmanCollection({ info, name, item }) {
const hoppscotchCollection = {

View File

@@ -194,15 +194,11 @@ const hideModal = () => {
const saveRequestAs = async () => {
if (!requestName.value) {
$toast.error(`${t("error.empty_req_name")}`, {
icon: "error_outline",
})
$toast.error(`${t("error.empty_req_name")}`)
return
}
if (picked.value === null) {
$toast.error(`${t("collection.select")}`, {
icon: "error_outline",
})
$toast.error(`${t("collection.select")}`)
return
}
@@ -283,9 +279,7 @@ const saveRequestAs = async () => {
requestSaved()
})
.catch((error) => {
$toast.error(t("profile.no_permission").toString(), {
icon: "error_outline",
})
$toast.error(`${t("profile.no_permission")}`)
throw new Error(error)
})
@@ -320,9 +314,7 @@ const saveRequestAs = async () => {
requestSaved()
} catch (error) {
$toast.error(t("profile.no_permission").toString(), {
icon: "error_outline",
})
$toast.error(`${t("profile.no_permission")}`)
console.error(error)
}
} else if (picked.value.pickedType === "teams-collection") {
@@ -352,9 +344,7 @@ const saveRequestAs = async () => {
requestSaved()
} catch (error) {
$toast.error(t("profile.no_permission").toString(), {
icon: "error_outline",
})
$toast.error(`${t("profile.no_permission")}`)
console.error(error)
}
} else if (picked.value.pickedType === "gql-my-request") {
@@ -386,9 +376,7 @@ const saveRequestAs = async () => {
}
const requestSaved = () => {
$toast.success(`${t("request.added")}`, {
icon: "post_add",
})
$toast.success(`${t("request.added")}`)
hideModal()
}

View File

@@ -49,9 +49,7 @@ export default defineComponent({
methods: {
addNewCollection() {
if (!this.name) {
this.$toast.error(`${this.$t("collection.invalid_name")}`, {
icon: "error_outline",
})
this.$toast.error(`${this.$t("collection.invalid_name")}`)
return
}

View File

@@ -251,9 +251,7 @@ export default defineComponent({
this.$emit("select", { picked: null })
}
removeGraphqlCollection(this.collectionIndex)
this.$toast.success(`${this.$t("state.deleted")}`, {
icon: "delete",
})
this.$toast.success(`${this.$t("state.deleted")}`)
},
dropEvent({ dataTransfer }: any) {
this.dragging = !this.dragging

View File

@@ -54,9 +54,7 @@ export default defineComponent({
methods: {
saveCollection() {
if (!this.name) {
this.$toast.error(`${this.$t("collection.invalid_name")}`, {
icon: "error_outline",
})
this.$toast.error(`${this.$t("collection.invalid_name")}`)
return
}
const collectionUpdated = {

View File

@@ -54,9 +54,7 @@ export default defineComponent({
methods: {
editFolder() {
if (!this.name) {
this.$toast.error(`${this.$t("collection.invalid_name")}`, {
icon: "error_outline",
})
this.$toast.error(`${this.$t("collection.invalid_name")}`)
return
}
editGraphqlFolder(this.folderPath, {

View File

@@ -58,9 +58,7 @@ export default defineComponent({
methods: {
saveRequest() {
if (!this.requestUpdateData.name) {
this.$toast.error(`${this.$t("collection.invalid_name")}`, {
icon: "error_outline",
})
this.$toast.error(`${this.$t("collection.invalid_name")}`)
return
}
const requestUpdated = {

View File

@@ -250,9 +250,7 @@ export default defineComponent({
}
removeGraphqlFolder(this.folderPath)
this.$toast.success(`${this.$t("state.deleted")}`, {
icon: "delete",
})
this.$toast.success(`${this.$t("state.deleted")}`)
},
dropEvent({ dataTransfer }: any) {
this.dragging = !this.dragging

View File

@@ -140,15 +140,11 @@ export default defineComponent({
}
)
.then((res) => {
this.$toast.success(this.$t("export.gist_created"), {
icon: "done",
})
this.$toast.success(this.$t("export.gist_created"))
window.open(res.html_url)
})
.catch((e) => {
this.$toast.error(this.$t("error.something_went_wrong"), {
icon: "error_outline",
})
this.$toast.error(this.$t("error.something_went_wrong"))
console.error(e)
})
},
@@ -252,23 +248,17 @@ export default defineComponent({
a.download = `${url.split("/").pop().split("#")[0].split("?")[0]}.json`
document.body.appendChild(a)
a.click()
this.$toast.success(this.$t("state.download_started"), {
icon: "downloading",
})
this.$toast.success(this.$t("state.download_started"))
setTimeout(() => {
document.body.removeChild(a)
URL.revokeObjectURL(url)
}, 1000)
},
fileImported() {
this.$toast.success(this.$t("state.file_imported"), {
icon: "folder_shared",
})
this.$toast.success(this.$t("state.file_imported"))
},
failedImport() {
this.$toast.error(this.$t("import.failed"), {
icon: "error_outline",
})
this.$toast.error(this.$t("import.failed"))
},
parsePostmanCollection({ info, name, item }) {
const hoppscotchCollection = {

View File

@@ -194,9 +194,7 @@ export default defineComponent({
}
removeGraphqlRequest(this.folderPath, this.requestIndex)
this.$toast.success(`${this.$t("state.deleted")}`, {
icon: "delete",
})
this.$toast.success(`${this.$t("state.deleted")}`)
},
},
})

View File

@@ -361,14 +361,10 @@ export default defineComponent({
this.collectionsType.selectedTeam.id
)
.then(() => {
this.$toast.success(this.$t("collection.created"), {
icon: "done",
})
this.$toast.success(this.$t("collection.created"))
})
.catch((e) => {
this.$toast.error(this.$t("error.something_went_wrong"), {
icon: "error_outline",
})
this.$toast.error(this.$t("error.something_went_wrong"))
console.error(e)
})
}
@@ -377,9 +373,7 @@ export default defineComponent({
// Intented to be called by CollectionEdit modal submit event
updateEditingCollection(newName) {
if (!newName) {
this.$toast.error(this.$t("collection.invalid_name"), {
icon: "error_outline",
})
this.$toast.error(this.$t("collection.invalid_name"))
return
}
if (this.collectionsType.type === "my-collections") {
@@ -396,14 +390,10 @@ export default defineComponent({
teamUtils
.renameCollection(this.$apollo, newName, this.editingCollection.id)
.then(() => {
this.$toast.success(this.$t("collection.renamed"), {
icon: "done",
})
this.$toast.success(this.$t("collection.renamed"))
})
.catch((e) => {
this.$toast.error(this.$t("error.something_went_wrong"), {
icon: "error_outline",
})
this.$toast.error(this.$t("error.something_went_wrong"))
console.error(e)
})
}
@@ -420,14 +410,10 @@ export default defineComponent({
teamUtils
.renameCollection(this.$apollo, name, this.editingFolder.id)
.then(() => {
this.$toast.success(this.$t("folder.renamed"), {
icon: "done",
})
this.$toast.success(this.$t("folder.renamed"))
})
.catch((e) => {
this.$toast.error(this.$t("error.something_went_wrong"), {
icon: "error_outline",
})
this.$toast.error(this.$t("error.something_went_wrong"))
console.error(e)
})
}
@@ -460,15 +446,11 @@ export default defineComponent({
this.editingRequestIndex
)
.then(() => {
this.$toast.success(this.$t("request.renamed"), {
icon: "done",
})
this.$toast.success(this.$t("request.renamed"))
this.$emit("update-team-collections")
})
.catch((e) => {
this.$toast.error(this.$t("error.something_went_wrong"), {
icon: "error_outline",
})
this.$toast.error(this.$t("error.something_went_wrong"))
console.error(e)
})
}
@@ -533,15 +515,11 @@ export default defineComponent({
},
})
.then(() => {
this.$toast.success(this.$t("folder.created"), {
icon: "done",
})
this.$toast.success(this.$t("folder.created"))
this.$emit("update-team-collections")
})
.catch((e) => {
this.$toast.error(this.$t("error.something_went_wrong"), {
icon: "error_outline",
})
this.$toast.error(this.$t("error.something_went_wrong"))
console.error(e)
})
}
@@ -605,9 +583,7 @@ export default defineComponent({
}
removeRESTCollection(collectionIndex)
this.$toast.success(this.$t("state.deleted"), {
icon: "delete",
})
this.$toast.success(this.$t("state.deleted"))
} else if (collectionsType.type === "team-collections") {
// Cancel pick if picked collection is deleted
if (
@@ -633,14 +609,10 @@ export default defineComponent({
},
})
.then(() => {
this.$toast.success(this.$t("state.deleted"), {
icon: "delete",
})
this.$toast.success(this.$t("state.deleted"))
})
.catch((e) => {
this.$toast.error(this.$t("error.something_went_wrong"), {
icon: "error_outline",
})
this.$toast.error(this.$t("error.something_went_wrong"))
console.error(e)
})
}
@@ -658,9 +630,7 @@ export default defineComponent({
this.$emit("select", { picked: null })
}
removeRESTRequest(folderPath, requestIndex)
this.$toast.success(this.$t("state.deleted"), {
icon: "delete",
})
this.$toast.success(this.$t("state.deleted"))
} else if (this.collectionsType.type === "team-collections") {
// Cancel pick if the picked item is being deleted
if (
@@ -674,14 +644,10 @@ export default defineComponent({
teamUtils
.deleteRequest(this.$apollo, requestIndex)
.then(() => {
this.$toast.success(this.$t("state.deleted"), {
icon: "delete",
})
this.$toast.success(this.$t("state.deleted"))
})
.catch((e) => {
this.$toast.error(this.$t("error.something_went_wrong"), {
icon: "error_outline",
})
this.$toast.error(this.$t("error.something_went_wrong"))
console.error(e)
})
}

View File

@@ -262,9 +262,7 @@ export default defineComponent({
this.$emit("select", { picked: null })
}
removeRESTFolder(this.folderPath)
this.$toast.success(this.$t("state.deleted"), {
icon: "delete",
})
this.$toast.success(this.$t("state.deleted"))
},
dropEvent({ dataTransfer }) {
this.dragging = !this.dragging

View File

@@ -253,15 +253,11 @@ export default defineComponent({
teamUtils
.deleteCollection(this.$apollo, this.folder.id)
.then(() => {
this.$toast.success(this.$t("state.deleted"), {
icon: "delete",
})
this.$toast.success(this.$t("state.deleted"))
this.$emit("update-team-collections")
})
.catch((e) => {
this.$toast.error(this.$t("error.something_went_wrong"), {
icon: "error_outline",
})
this.$toast.error(this.$t("error.something_went_wrong"))
console.error(e)
})
this.$emit("update-team-collections")