From 1ae859b7f1759ad99615e9bc6700c9172030daec Mon Sep 17 00:00:00 2001
From: ydcjeff <32727188+ydcjeff@users.noreply.github.com>
Date: Thu, 6 May 2021 23:05:51 +0630
Subject: [PATCH] feat: show thanksgiving message after download

---
 src/components/IconDiscord.vue  |  2 +-
 src/components/IconDownload.vue | 32 +++++---------
 src/components/IconGitHub.vue   |  2 +-
 src/components/IconTwitter.vue  |  2 +-
 src/components/NavBar.vue       | 77 ++++++++++++++++++++++++++++++---
 src/components/PaneSplit.vue    |  4 +-
 6 files changed, 89 insertions(+), 30 deletions(-)

diff --git a/src/components/IconDiscord.vue b/src/components/IconDiscord.vue
index 2f5ddab3..0a27979c 100644
--- a/src/components/IconDiscord.vue
+++ b/src/components/IconDiscord.vue
@@ -1,5 +1,5 @@
 <template>
-  <svg width="20" height="20" viewBox="0 0 448 512">
+  <svg width="1.4em" height="1.4em" viewBox="0 0 448 512" class="icons">
     <path
       d="M297.216 243.2c0 15.616-11.52 28.416-26.112 28.416c-14.336 0-26.112-12.8-26.112-28.416s11.52-28.416 26.112-28.416c14.592 0 26.112 12.8 26.112 28.416zm-119.552-28.416c-14.592 0-26.112 12.8-26.112 28.416s11.776 28.416 26.112 28.416c14.592 0 26.112-12.8 26.112-28.416c.256-15.616-11.52-28.416-26.112-28.416zM448 52.736V512c-64.494-56.994-43.868-38.128-118.784-107.776l13.568 47.36H52.48C23.552 451.584 0 428.032 0 398.848V52.736C0 23.552 23.552 0 52.48 0h343.04C424.448 0 448 23.552 448 52.736zm-72.96 242.688c0-82.432-36.864-149.248-36.864-149.248c-36.864-27.648-71.936-26.88-71.936-26.88l-3.584 4.096c43.52 13.312 63.744 32.512 63.744 32.512c-60.811-33.329-132.244-33.335-191.232-7.424c-9.472 4.352-15.104 7.424-15.104 7.424s21.248-20.224 67.328-33.536l-2.56-3.072s-35.072-.768-71.936 26.88c0 0-36.864 66.816-36.864 149.248c0 0 21.504 37.12 78.08 38.912c0 0 9.472-11.52 17.152-21.248c-32.512-9.728-44.8-30.208-44.8-30.208c3.766 2.636 9.976 6.053 10.496 6.4c43.21 24.198 104.588 32.126 159.744 8.96c8.96-3.328 18.944-8.192 29.44-15.104c0 0-12.8 20.992-46.336 30.464c7.68 9.728 16.896 20.736 16.896 20.736c56.576-1.792 78.336-38.912 78.336-38.912z"
       fill="currentColor"
diff --git a/src/components/IconDownload.vue b/src/components/IconDownload.vue
index a2fb2a29..6d8cc257 100644
--- a/src/components/IconDownload.vue
+++ b/src/components/IconDownload.vue
@@ -1,26 +1,18 @@
 <template>
   <svg
     xmlns="http://www.w3.org/2000/svg"
-    xmlns:xlink="http://www.w3.org/1999/xlink"
-    aria-hidden="true"
-    role="img"
-    class="iconify download iconify--system-uicons"
-    width="20"
-    height="20"
-    preserveAspectRatio="xMidYMid meet"
-    viewBox="0 0 21 21"
+    width="1.4em"
+    height="1.4em"
+    viewBox="0 0 24 24"
+    fill="none"
+    stroke="currentColor"
+    stroke-width="2"
+    stroke-linecap="round"
+    stroke-linejoin="round"
+    class="icons feather feather-download"
   >
-    <g
-      fill="none"
-      fill-rule="evenodd"
-      stroke="currentColor"
-      stroke-width="1.5"
-      stroke-linecap="round"
-      stroke-linejoin="round"
-    >
-      <path d="M6.5 10.5l4 4.232l4-4.191"></path>
-      <path d="M10.5 3.5v11"></path>
-      <path d="M4.5 17.5h12"></path>
-    </g>
+    <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path>
+    <polyline points="7 10 12 15 17 10"></polyline>
+    <line x1="12" y1="15" x2="12" y2="3"></line>
   </svg>
 </template>
diff --git a/src/components/IconGitHub.vue b/src/components/IconGitHub.vue
index b5d66494..4360be07 100644
--- a/src/components/IconGitHub.vue
+++ b/src/components/IconGitHub.vue
@@ -1,5 +1,5 @@
 <template>
-  <svg width="20" height="20" viewBox="0 0 496 512">
+  <svg width="1.4em" height="1.4em" viewBox="0 0 496 512" class="icons">
     <path
       d="M165.9 397.4c0 2-2.3 3.6-5.2 3.6c-3.3.3-5.6-1.3-5.6-3.6c0-2 2.3-3.6 5.2-3.6c3-.3 5.6 1.3 5.6 3.6zm-31.1-4.5c-.7 2 1.3 4.3 4.3 4.9c2.6 1 5.6 0 6.2-2s-1.3-4.3-4.3-5.2c-2.6-.7-5.5.3-6.2 2.3zm44.2-1.7c-2.9.7-4.9 2.6-4.6 4.9c.3 2 2.9 3.3 5.9 2.6c2.9-.7 4.9-2.6 4.6-4.6c-.3-1.9-3-3.2-5.9-2.9zM244.8 8C106.1 8 0 113.3 0 252c0 110.9 69.8 205.8 169.5 239.2c12.8 2.3 17.3-5.6 17.3-12.1c0-6.2-.3-40.4-.3-61.4c0 0-70 15-84.7-29.8c0 0-11.4-29.1-27.8-36.6c0 0-22.9-15.7 1.6-15.4c0 0 24.9 2 38.6 25.8c21.9 38.6 58.6 27.5 72.9 20.9c2.3-16 8.8-27.1 16-33.7c-55.9-6.2-112.3-14.3-112.3-110.5c0-27.5 7.6-41.3 23.6-58.9c-2.6-6.5-11.1-33.3 2.6-67.9c20.9-6.5 69 27 69 27c20-5.6 41.5-8.5 62.8-8.5s42.8 2.9 62.8 8.5c0 0 48.1-33.6 69-27c13.7 34.7 5.2 61.4 2.6 67.9c16 17.7 25.8 31.5 25.8 58.9c0 96.5-58.9 104.2-114.8 110.5c9.2 7.9 17 22.9 17 46.4c0 33.7-.3 75.4-.3 83.6c0 6.5 4.6 14.4 17.3 12.1C428.2 457.8 496 362.9 496 252C496 113.3 383.5 8 244.8 8zM97.2 352.9c-1.3 1-1 3.3.7 5.2c1.6 1.6 3.9 2.3 5.2 1c1.3-1 1-3.3-.7-5.2c-1.6-1.6-3.9-2.3-5.2-1zm-10.8-8.1c-.7 1.3.3 2.9 2.3 3.9c1.6 1 3.6.7 4.3-.7c.7-1.3-.3-2.9-2.3-3.9c-2-.6-3.6-.3-4.3.7zm32.4 35.6c-1.6 1.3-1 4.3 1.3 6.2c2.3 2.3 5.2 2.6 6.5 1c1.3-1.3.7-4.3-1.3-6.2c-2.2-2.3-5.2-2.6-6.5-1zm-11.4-14.7c-1.6 1-1.6 3.6 0 5.9c1.6 2.3 4.3 3.3 5.6 2.3c1.6-1.3 1.6-3.9 0-6.2c-1.4-2.3-4-3.3-5.6-2z"
       fill="currentColor"
diff --git a/src/components/IconTwitter.vue b/src/components/IconTwitter.vue
index 11ec9613..80ed5d81 100644
--- a/src/components/IconTwitter.vue
+++ b/src/components/IconTwitter.vue
@@ -1,5 +1,5 @@
 <template>
-  <svg width="20" height="20" viewBox="0 0 512 512">
+  <svg width="1.4em" height="1.4em" viewBox="0 0 512 512" class="icons">
     <path
       d="M459.37 151.716c.325 4.548.325 9.097.325 13.645c0 138.72-105.583 298.558-298.558 298.558c-59.452 0-114.68-17.219-161.137-47.106c8.447.974 16.568 1.299 25.34 1.299c49.055 0 94.213-16.568 130.274-44.832c-46.132-.975-84.792-31.188-98.112-72.772c6.498.974 12.995 1.624 19.818 1.624c9.421 0 18.843-1.3 27.614-3.573c-48.081-9.747-84.143-51.98-84.143-102.985v-1.299c13.969 7.797 30.214 12.67 47.431 13.319c-28.264-18.843-46.781-51.005-46.781-87.391c0-19.492 5.197-37.36 14.294-52.954c51.655 63.675 129.3 105.258 216.365 109.807c-1.624-7.797-2.599-15.918-2.599-24.04c0-57.828 46.782-104.934 104.934-104.934c30.213 0 57.502 12.67 76.67 33.137c23.715-4.548 46.456-13.32 66.599-25.34c-7.798 24.366-24.366 44.833-46.132 57.827c21.117-2.273 41.584-8.122 60.426-16.243c-14.292 20.791-32.161 39.308-52.628 54.253z"
       fill="currentColor"
diff --git a/src/components/NavBar.vue b/src/components/NavBar.vue
index a8546c4d..200cd013 100644
--- a/src/components/NavBar.vue
+++ b/src/components/NavBar.vue
@@ -18,8 +18,8 @@
         class="download-button"
         title="Download the generated code as a zip file"
       >
-        Download
         <IconDownload />
+        <span class="icon-text">Download</span>
       </button>
       <a
         class="external-links"
@@ -28,6 +28,7 @@
         rel="noopener noreferrer"
       >
         <IconGitHub />
+        <span class="icon-text">GitHub</span>
       </a>
       <a
         class="external-links"
@@ -36,6 +37,7 @@
         rel="noopener noreferrer"
       >
         <IconTwitter />
+        <span class="icon-text">Twitter</span>
       </a>
       <a
         class="external-links"
@@ -44,8 +46,31 @@
         rel="noopener noreferrer"
       >
         <IconDiscord />
+        <span class="icon-text">Discord</span>
       </a>
     </div>
+    <div
+      class="download-success"
+      v-show="showDownloadMsg"
+      @click="showDownloadMsg = false"
+    >
+      <div class="msg-wrapper">
+        <div class="msg">
+          <h2>🎉 Your Training Script Generated! 🎉</h2>
+          <p>
+            Thanks for using Code-Generator! Feel free to reach out to us on
+            <a
+              class="external-links msg-gh"
+              href="https://github.com/pytorch-ignite/code-generator"
+              target="_blank"
+              rel="noopener noreferrer"
+            >
+              GitHub </a
+            >with any feedback, bug report, and feature request.
+          </p>
+        </div>
+      </div>
+    </div>
   </nav>
 </template>
 
@@ -58,11 +83,13 @@ import IconDiscord from './IconDiscord.vue'
 import IconDownload from './IconDownload.vue'
 import IconGitHub from './IconGitHub.vue'
 import IconTwitter from './IconTwitter.vue'
+import { ref } from 'vue'
 
 export default {
   components: { IconDiscord, IconDownload, IconGitHub, IconTwitter },
   setup() {
     let zip = new JSZip()
+    const showDownloadMsg = ref(false)
 
     const downloadProject = () => {
       for (const filename in store.code) {
@@ -71,9 +98,10 @@ export default {
       zip.generateAsync({ type: 'blob' }).then((content) => {
         saveAs(content, 'ignite-project.zip')
       })
+      showDownloadMsg.value = true
     }
 
-    return { version, downloadProject }
+    return { version, downloadProject, showDownloadMsg }
   }
 }
 </script>
@@ -95,6 +123,10 @@ h1 img {
 .external-links {
   margin: 0 0.5rem;
   font-size: var(--font-size);
+  border-bottom: 2px solid transparent;
+}
+.external-links:hover {
+  border-bottom: 2px solid var(--c-brand-red);
 }
 .nav-bar {
   display: flex;
@@ -123,11 +155,43 @@ h1 img {
   cursor: pointer;
   font-family: var(--font-family-base);
   font-size: var(--font-size);
+  padding-top: 0;
+  padding-bottom: 0;
 }
-.iconify {
+.icons {
   vertical-align: middle;
   position: relative;
-  top: -3px;
+  top: -1px;
+}
+.download-success {
+  position: fixed;
+  top: 0;
+  left: 0;
+  background-color: rgba(101, 110, 133, 0.8);
+  z-index: 10;
+  width: 100vw;
+  height: 100vh;
+}
+.msg-wrapper {
+  display: block;
+  max-width: 38rem;
+  margin: 20vh auto 0;
+  text-align: center;
+  padding: 0 1rem;
+}
+.msg {
+  padding: 2rem 1rem;
+  background-color: var(--c-white-light);
+  color: var(--c-text);
+  border-radius: 8px;
+  box-shadow: 0 0 5px 5px rgba(0, 0, 0, 0.33);
+}
+.msg-gh {
+  margin: 0;
+  color: var(--c-brand-red);
+}
+.icon-text {
+  margin-left: 0.5rem;
 }
 /* media queries */
 @media (max-width: 768px) {
@@ -137,9 +201,12 @@ h1 img {
   }
   .nav-bar {
     position: fixed;
-    z-index: 11;
+    z-index: 6;
     width: 100%;
     background-color: var(--c-white);
   }
+  .icon-text {
+    display: none;
+  }
 }
 </style>
diff --git a/src/components/PaneSplit.vue b/src/components/PaneSplit.vue
index e1748351..09022ca3 100644
--- a/src/components/PaneSplit.vue
+++ b/src/components/PaneSplit.vue
@@ -148,13 +148,13 @@ export default {
     border-radius: 2px;
     width: 2rem;
     height: 2rem;
-    z-index: 99999;
+    z-index: 6;
   }
   .left {
     position: fixed;
     transform: translateX(-100%);
     transition: transform 0.25s ease-in;
-    z-index: 10;
+    z-index: 5;
     background-color: var(--c-white);
     top: 0;
     bottom: 0;