Skip to content

Commit 7834585

Browse files
authored
feat: add help for getting started steps (#156)
1 parent 44c2a45 commit 7834585

19 files changed

+345
-201
lines changed

src/App.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ h5,
5555
h6 {
5656
font-weight: 500;
5757
}
58-
@media (max-width: 768px) {
58+
@media (max-width: 915px) {
5959
h1 {
6060
font-size: 1.5rem;
6161
}

src/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ This is the source directory of Code-Generator App.
66

77
- `assets` - includes image files
88
- `components` - includes Vue components
9+
- `components/css` - includes the common css code used in components
910
- `metadata` - includes the data of the app in json format (Distributed/Non-distributed training values, Ignite Handlers, and Loggers)
1011
- `templates` - includes deep learning training template scripts
1112

@@ -28,6 +29,7 @@ The following table explains the usage of some notable components. The component
2829
| [`Instruction`](./components/Instruction.vue) | Use for showing how to get started |
2930
| [`Message`](./components/Message.vue) | Use for showing the status of user input event (copying code, missing configuration values when attempting to download) |
3031
| [`NavBar`](./components/NavBar.vue) | Use for navigation bar |
32+
| [`NavHelp`](./components/NavHelp.vue) | Use for showing step by step guide |
3133
| [`PaneLeft`](./components/PaneLeft.vue) | Use for everything in the left pane |
3234
| [`PaneRight`](./components/PaneRight.vue) | Use for everything in the right pane |
3335
| [`PaneSplit`](./components/PaneSplit.vue) | Use for how to split the left pane, right pane, and split line |

src/components/CodeBlock.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ div[class~='language-yaml']::before {
168168
content: 'yaml';
169169
}
170170
/* media queries */
171-
@media (max-width: 768px) {
171+
@media (max-width: 915px) {
172172
.code-block-wrapper {
173173
height: 100%;
174174
}

src/components/IconDiscord.vue

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/components/IconDownload.vue

Lines changed: 0 additions & 18 deletions
This file was deleted.

src/components/IconGitHub.vue

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/components/IconTwitter.vue

Lines changed: 0 additions & 8 deletions
This file was deleted.

src/components/Instruction.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
xmlns:xlink="http://www.w3.org/1999/xlink"
88
aria-hidden="true"
99
role="img"
10-
class="iconify iconify--carbon animate-bounce"
10+
class="animate-bounce iconify iconify--carbon"
1111
width="32"
1212
height="32"
1313
preserveAspectRatio="xMidYMid meet"
@@ -60,7 +60,7 @@
6060
.mobile {
6161
display: none;
6262
}
63-
@media (max-width: 768px) {
63+
@media (max-width: 915px) {
6464
.desktop {
6565
display: none;
6666
}

src/components/NavBar.vue

Lines changed: 16 additions & 151 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@
1212
</RouterLink>
1313
</h1>
1414
<div class="left-side-badges">
15+
<NavHelp />
16+
<NavDownload />
17+
<NavGitHub />
18+
<NavTwitter />
19+
<NavDiscord />
1520
<a
1621
:href="`https://github.com/pytorch-ignite/code-generator/commit/${currentCommit}`"
1722
target="_blank"
@@ -20,114 +25,31 @@
2025
>
2126
v{{ version }}@{{ currentCommit.slice(0, 7) }}
2227
</a>
23-
<button
24-
@click="downloadProject"
25-
class="download-button"
26-
title="Download the generated code as a zip file"
27-
>
28-
<IconDownload />
29-
<span class="icon-text">Download</span>
30-
</button>
31-
<a
32-
class="external-links"
33-
href="https://github.com/pytorch-ignite/code-generator"
34-
target="_blank"
35-
rel="noopener noreferrer"
36-
>
37-
<IconGitHub />
38-
<span class="icon-text">GitHub</span>
39-
</a>
40-
<a
41-
class="external-links"
42-
href="https://twitter.com/pytorch_ignite"
43-
target="_blank"
44-
rel="noopener noreferrer"
45-
>
46-
<IconTwitter />
47-
<span class="icon-text">Twitter</span>
48-
</a>
49-
<a
50-
class="external-links"
51-
href="https://discord.gg/djZtm3EmKj"
52-
target="_blank"
53-
rel="noopener noreferrer"
54-
>
55-
<IconDiscord />
56-
<span class="icon-text">Discord</span>
57-
</a>
58-
</div>
59-
<div
60-
class="download-success"
61-
v-show="showDownloadMsg"
62-
@click="showDownloadMsg = false"
63-
>
64-
<div class="msg-wrapper">
65-
<div class="msg">
66-
<h2>🎉 Your Training Script Has Been Generated! 🎉</h2>
67-
<p>
68-
Thanks for using Code-Generator! Feel free to reach out to us on
69-
<a
70-
class="external-links msg-gh"
71-
href="https://github.com/pytorch-ignite/code-generator"
72-
target="_blank"
73-
rel="noopener noreferrer"
74-
>
75-
GitHub </a
76-
>with any feedback, bug report, and feature request.
77-
</p>
78-
</div>
79-
</div>
8028
</div>
8129
</nav>
8230
</template>
8331

8432
<script>
8533
import { version } from '../../package.json'
86-
import { store, msg } from '../store'
87-
import { saveAs } from 'file-saver'
88-
import JSZip from 'jszip'
89-
import IconDiscord from './IconDiscord.vue'
90-
import IconDownload from './IconDownload.vue'
91-
import IconGitHub from './IconGitHub.vue'
92-
import IconTwitter from './IconTwitter.vue'
93-
import { ref } from 'vue'
34+
import NavDiscord from './NavDiscord.vue'
35+
import NavDownload from './NavDownload.vue'
36+
import NavGitHub from './NavGitHub.vue'
37+
import NavTwitter from './NavTwitter.vue'
38+
import NavHelp from './NavHelp.vue'
9439
9540
export default {
96-
components: { IconDiscord, IconDownload, IconGitHub, IconTwitter },
41+
components: { NavDiscord, NavDownload, NavGitHub, NavTwitter, NavHelp },
9742
setup() {
98-
const showDownloadMsg = ref(false)
99-
const currentCommit = __COMMIT__ /* from vite.config.js */
43+
const currentCommit = __COMMIT__ // from vite.config.js
10044
101-
const downloadProject = () => {
102-
const zip = new JSZip()
103-
if (store.code && Object.keys(store.code).length) {
104-
msg.color = 'red'
105-
if (!store.config.output_dir) {
106-
msg.showMsg = true
107-
msg.content = `Output directory is required. Please input in Loggers tab.`
108-
} else if (!store.config.log_every_iters) {
109-
msg.showMsg = true
110-
msg.content = `Logging interval is required. Please input in Loggers tab.`
111-
} else {
112-
for (const filename in store.code) {
113-
zip.file(filename, store.code[filename])
114-
}
115-
zip.generateAsync({ type: 'blob' }).then((content) => {
116-
saveAs(content, `ignite-${store.config.template}.zip`)
117-
})
118-
showDownloadMsg.value = true
119-
}
120-
} else {
121-
msg.showMsg = true
122-
msg.content = 'Choose a template to download.'
123-
}
124-
}
125-
return { version, downloadProject, showDownloadMsg, currentCommit }
45+
return { version, currentCommit }
12646
}
12747
}
12848
</script>
12949

13050
<style scoped>
51+
@import url('./css/nav-right.css');
52+
13153
h1 {
13254
margin: 0;
13355
font-weight: normal;
@@ -137,13 +59,6 @@ h1 img {
13759
position: relative;
13860
top: -5px;
13961
}
140-
.external-links {
141-
margin: 0 0.5rem;
142-
border-bottom: 2px solid transparent;
143-
}
144-
.external-links:hover {
145-
border-bottom: 2px solid var(--c-brand-red);
146-
}
14762
.nav-bar {
14863
display: flex;
14964
align-items: center;
@@ -156,52 +71,8 @@ h1 img {
15671
align-items: center;
15772
font-size: 0.9em;
15873
}
159-
.download-button {
160-
background: none;
161-
color: var(--c-text);
162-
cursor: pointer;
163-
font-family: var(--font-family-base);
164-
font-size: 1em;
165-
padding-top: 0;
166-
padding-bottom: 0;
167-
}
168-
.icons {
169-
vertical-align: middle;
170-
position: relative;
171-
top: -1px;
172-
}
173-
.download-success {
174-
position: fixed;
175-
top: 0;
176-
left: 0;
177-
background-color: rgba(101, 110, 133, 0.8);
178-
z-index: 10;
179-
width: 100vw;
180-
height: 100vh;
181-
}
182-
.msg-wrapper {
183-
display: block;
184-
max-width: 38rem;
185-
margin: 20vh auto 0;
186-
text-align: center;
187-
padding: 0 1rem;
188-
}
189-
.msg {
190-
padding: 2rem 1rem;
191-
background-color: var(--c-white-light);
192-
color: var(--c-text);
193-
border-radius: 8px;
194-
box-shadow: 0 0 5px 5px rgba(0, 0, 0, 0.33);
195-
}
196-
.msg-gh {
197-
margin: 0;
198-
color: var(--c-brand-red);
199-
}
200-
.icon-text {
201-
margin-left: 0.25rem;
202-
}
20374
/* media queries */
204-
@media (max-width: 768px) {
75+
@media (max-width: 915px) {
20576
.pname {
20677
display: none;
20778
}
@@ -212,11 +83,5 @@ h1 img {
21283
padding: 0.5rem 0.5rem 0;
21384
background-color: var(--c-white);
21485
}
215-
.external-links {
216-
margin: 0 0.25rem;
217-
}
218-
.icon-text {
219-
display: none;
220-
}
22186
}
22287
</style>

src/components/NavDiscord.vue

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<template>
2+
<a
3+
class="external-links"
4+
href="https://discord.gg/djZtm3EmKj"
5+
target="_blank"
6+
rel="noopener noreferrer"
7+
>
8+
<svg width="1.4em" height="1.4em" viewBox="0 0 448 512" class="icons">
9+
<path
10+
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"
11+
fill="currentColor"
12+
></path>
13+
</svg>
14+
<span class="icon-text">Discord</span>
15+
</a>
16+
</template>
17+
18+
<style scoped>
19+
@import url('./css/nav-right.css');
20+
</style>

0 commit comments

Comments
 (0)