From 9243c4f9121b69189ffb63930fe0113507ab5629 Mon Sep 17 00:00:00 2001
From: devhyun637 <59258239+devhyun637@users.noreply.github.com>
Date: Mon, 14 Dec 2020 12:23:36 +0900
Subject: [PATCH 01/48] =?UTF-8?q?docs=20:=20=EC=A7=80=ED=95=98=EC=B2=A0=20?=
=?UTF-8?q?=EB=85=B8=EC=84=A0=EB=8F=84=20=EB=AF=B8=EC=85=98=20=EA=B8=B0?=
=?UTF-8?q?=EB=8A=A5=20=EA=B5=AC=ED=98=84=20=EB=AA=A9=EB=A1=9D=20=EC=9E=91?=
=?UTF-8?q?=EC=84=B1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 127 +++++++++++-------------------------------------------
1 file changed, 25 insertions(+), 102 deletions(-)
diff --git a/README.md b/README.md
index e97a1d649..a68c94b37 100644
--- a/README.md
+++ b/README.md
@@ -1,114 +1,37 @@
# π μ§νμ² λ
Έμ λ λ―Έμ
+μ§νμ² μμ μΆκ° λ° μμ νκ³ , μμ±λ λ
Έμ μ μμ μΆκ°νκ³ μμ ν μ μλ νλ‘κ·Έλ¨μ΄λ€.
-## π κΈ°λ₯ μꡬμ¬ν
+## π κΈ°λ₯ ꡬν λͺ©λ‘
+1. μ¬μ©μλ λ²νΌ 4κ°(μ κ΄λ¦¬, λ
Έμ κ΄λ¦¬, κ΅¬κ° κ΄λ¦¬, μ§νμ² λ
Έμ λ μΆλ ₯)λ₯Ό μ νν μ μλ€.
### μ§νμ² μ κ΄λ ¨ κΈ°λ₯
-- μ§νμ² μμ λ±λ‘νκ³ μμ ν μ μλ€. (λ¨, λ
Έμ μ λ±λ‘λ μμ μμ ν μ μλ€)
-- μ€λ³΅λ μ§νμ² μ μ΄λ¦μ΄ λ±λ‘λ μ μλ€.
-- μ§νμ² μμ 2κΈμ μ΄μμ΄μ΄μΌ νλ€.
-- μ§νμ² μμ λͺ©λ‘μ μ‘°νν μ μλ€.
+2. μ¬μ©μλ μμ λ±λ‘ν μ μλ€.
+ - [μμΈμ²λ¦¬] 2κΈμ μ΄μμ μ΄λ¦μΈμ§ κ²μ¦ν΄μΌ νλ€.
+ - [μμΈμ²λ¦¬] μ€λ³΅λ μ΄λ¦μ΄ μλμ§ κ²μ¦ν΄μΌ νλ€.
+3. μ¬μ©μλ μμ μμ ν μ μλ€.
+ - [μμΈμ²λ¦¬] λ
Έμ μ μλμ§ κ²μ¦νκ³ , λ
Έμ μ μλ€λ©΄ μμ ν μ μλ€.
+4. μ¬μ©μ μ§νμ² μμ λͺ©λ‘μ μ‘°νν μ μλ€.
### μ§νμ² λ
Έμ κ΄λ ¨ κΈ°λ₯
-- μ§νμ² λ
Έμ μ λ±λ‘νκ³ μμ ν μ μλ€.
-- μ€λ³΅λ μ§νμ² λ
Έμ μ΄λ¦μ΄ λ±λ‘λ μ μλ€.
-- λ
Έμ λ±λ‘ μ μν μ’
μ μκ³Ό νν μ’
μ μμ μ
λ ₯λ°λλ€.
-- μ§νμ² λ
Έμ μ λͺ©λ‘μ μ‘°νν μ μλ€.
+5. μ¬μ©μλ μ§νμ² λ
Έμ μ λ±λ‘ν μ μλ€.
+ - [쑰건] λ
Έμ λ±λ‘ μ μν μ’
μ μκ³Ό νν μ’
μ μμ μ
λ ₯λ°λλ€.
+ - [μμΈμ²λ¦¬] μ€λ³΅λ λ
Έμ μ΄λ¦μ΄ μλμ§ κ²μ¦ν΄μΌ νλ€.
+ - [μμΈμ²λ¦¬] ~μ ννμ μ΄λ¦μΈμ§ κ²μ¦ν΄μΌ νλ€.
+ - [μμΈμ²λ¦¬] μμμ κ³Ό λμ μ΄ κ°μ λ
Έμ μ΄ μλμ§ κ²μ¦ν΄μΌ νλ€.
+6. μ¬μ©μλ μ§νμ² λ
Έμ μ μμ ν μ μλ€.
+7. μ¬μ©μλ μ§νμ² λ
Έμ μ λͺ©λ‘μ μ‘°νν μ μλ€.
### μ§νμ² κ΅¬κ° μΆκ° κΈ°λ₯
-- μ§νμ² λ
Έμ μ ꡬκ°μ μΆκ°νλ κΈ°λ₯μ λ
Έμ μ μμ μΆκ°νλ κΈ°λ₯μ΄λΌκ³ λ ν μ μλ€.
- - μκ³Ό μμ¬μ΄λ₯Ό ꡬκ°μ΄λΌ νκ³ μ΄ κ΅¬κ°λ€μ λͺ¨μμ΄ λ
Έμ μ΄λ€.
-- νλμ μμ μ¬λ¬κ°μ λ
Έμ μ μΆκ°λ μ μλ€.
-- μκ³Ό μ μ¬μ΄μ μλ‘μ΄ μμ΄ μΆκ° λ μ μλ€.
-- λ
Έμ μμ κ°λκΈΈμ μκΈΈ μ μλ€.
-
-
+8. μ¬μ©μλ λ
Έμ μ μμ μΆκ°ν μ μλ€.
+ - [μμΈμ²λ¦¬] μ€λ³΅λ λ
Έμ μ΄ μλμ§ κ²μ¦ν΄μΌ νλ€.
+ - [쑰건] νλμ μμ μ¬λ¬κ°μ λ
Έμ μ μΆκ°λ μ μλ€.
+ - [쑰건] μκ³Ό μ μ¬μ΄μ μλ‘μ΄ μμ΄ μΆκ° λ μ μλ€.
+ - [쑰건] λ
Έμ μμ κ°λκΈΈμ μκΈΈ μ μλ€.
### μ§νμ² κ΅¬κ° μμ κΈ°λ₯
-- λ
Έμ μ λ±λ‘λ μμ μ κ±°ν μ μλ€.
-- μ’
μ μ μ κ±°ν κ²½μ° λ€μ μμ΄ μ’
μ μ΄ λλ€.
-- λ
Έμ μ ν¬ν¨λ μμ΄ λκ° μ΄νμΌ λλ μμ μ κ±°ν μ μλ€.
-
-
+9. μ¬μ©μλ λ
Έμ μ μμ μμ ν μ μλ€.
+ - [μμΈμ²λ¦¬] λ
Έμ μ μμ΄ 2κ° μ΄νμΈμ§ κ²μ¦νκ³ , 2κ° μ΄νλ©΄ μμ ν μ μλ€.
+ - [쑰건] μ’
μ μ μ κ±°ν κ²½μ° λ€μ μμ΄ μ’
μ μ΄ λλ€.
### μ§νμ² λ
Έμ μ λ±λ‘λ μ μ‘°ν κΈ°λ₯
-- λ
Έμ μ μν μ’
μ λΆν° νν μ’
μ κΉμ§ μ°κ²°λ μμλλ‘ μ λͺ©λ‘μ μ‘°νν μ μλ€.
-
-
-
-## π» νλ‘κ·Έλ¨ μ€ν κ²°κ³Ό
-
-### μκ΄λ¦¬
-
-
-### λ
Έμ κ΄λ¦¬
-
-
-### ꡬκ°κ΄λ¦¬
-
-
-### λ
Έμ λ μΆλ ₯
-
-
-
-## β
νλ‘κ·Έλλ° μꡬμ¬ν
-
-### λ©λ΄ λ²νΌ
-- μ κ΄λ¦¬ button νκ·Έλ `#station-manager-button` idκ°μ κ°μ§λ€.
-- λ
Έμ κ΄λ¦¬ button νκ·Έλ `#line-manager-button` idκ°μ κ°μ§λ€.
-- κ΅¬κ° κ΄λ¦¬ button νκ·Έλ `#section-manager-button` idκ°μ κ°μ§λ€.
-- μ§νμ² λ
Έμ λ μΆλ ₯ κ΄λ¦¬ button νκ·Έλ `#map-print-manager-button` idκ°μ κ°μ§λ€.
-
-### μ§νμ² μ κ΄λ ¨ κΈ°λ₯
-- μ§νμ² μμ μ
λ ₯νλ input νκ·Έλ `#station-name-input` idκ°μ κ°μ§λ€.
-- μ§νμ² μμ μΆκ°νλ button νκ·Έλ `#station-add-button` idκ°μ κ°μ§λ€.
-- μ§νμ² μμ μμ νλ button νκ·Έλ `.station-delete-button` classκ°μ κ°μ§λ€.
-
-### μ§νμ² λ
Έμ κ΄λ ¨ κΈ°λ₯
-- μ§νμ² λ
Έμ μ μ΄λ¦μ μ
λ ₯νλ input νκ·Έλ `#line-name-input` idκ°μ κ°μ§λ€.
-- μ§νμ² λ
Έμ μ μν μ’
μ μ μ ννλ select νκ·Έλ `#line-start-station-selector` idκ°μ κ°μ§λ€.
-- μ§νμ² λ
Έμ μ νν μ’
μ μ μ ννλ select νκ·Έλ `#line-end-station-selector` idκ°μ κ°μ§λ€.
-- μ§νμ² λ
Έμ μ μΆκ°νλ button νκ·Έλ `#line-add-button` idκ°μ κ°μ§λ€.
-- μ§νμ² λ
Έμ μ μμ νλ button νκ·Έλ `.line-delete-button` classκ°μ κ°μ§λ€.
-
-### μ§νμ² κ΅¬κ° μΆκ° κΈ°λ₯
-- μ§νμ² λ
Έμ μ μ ννλ button νκ·Έλ `.section-line-menu-button` classκ°μ κ°μ§λ€.
-- μ§νμ² κ΅¬κ°μ μ€μ ν μ select νκ·Έλ `#section-station-selector` idκ°μ κ°μ§λ€.
-- μ§νμ² κ΅¬κ°μ μμλ₯Ό μ
λ ₯νλ input νκ·Έλ `#section-order-input` idκ°μ κ°μ§λ€.
-- μ§νμ² κ΅¬κ°μ λ±λ‘νλ button νκ·Έλ `#section-add-button` idκ°μ κ°μ§λ€.
-- μ§νμ² κ΅¬κ°μ μ κ±°νλ button νκ·Έλ `.section-delete-button` classκ°μ κ°μ§λ€.
-
-### μ§νμ² λ
Έμ λ μΆλ ₯ κΈ°λ₯
-- μ§νμ² λ
Έμ λ μΆλ ₯ λ²νΌμ λλ₯΄λ©΄ `
` νκ·Έλ₯Ό λ§λ€κ³ ν΄λΉ νκ·Έ λ΄λΆμ λ
Έμ λλ₯Ό μΆλ ₯νλ€.
-
-### κΈ°μ‘΄ μꡬμ¬ν
-
-- μ¬μ©μκ° μλͺ»λ μ
λ ₯ κ°μ μμ±ν κ²½μ° `alert`μ μ΄μ©ν΄ λ©μμ§λ₯Ό 보μ¬μ£Όκ³ , μ¬μ
λ ₯ν μ μκ² νλ€.
-- μΈλΆ λΌμ΄λΈλ¬λ¦¬(jQuery, Lodash λ±)λ₯Ό μ¬μ©νμ§ μκ³ , μμ Vanilla JSλ‘λ§ κ΅¬ννλ€.
-- **μλ°μ€ν¬λ¦½νΈ μ½λ 컨벀μ
μ μ§ν€λ©΄μ νλ‘κ·Έλλ°** νλ€
- - [https://google.github.io/styleguide/jsguide.html](https://google.github.io/styleguide/jsguide.html)
- - [https://ui.toast.com/fe-guide/ko_CODING-CONVENSION/](https://ui.toast.com/fe-guide/ko_CODING-CONVENTION)
-- **indent(μΈλ΄νΈ, λ€μ¬μ°κΈ°) depthλ₯Ό 3μ΄ λμ§ μλλ‘ κ΅¬ννλ€. 2κΉμ§λ§ νμ©**νλ€.
- - μλ₯Ό λ€μ΄ whileλ¬Έ μμ ifλ¬Έμ΄ μμΌλ©΄ λ€μ¬μ°κΈ°λ 2μ΄λ€.
- - ννΈ: indent(μΈλ΄νΈ, λ€μ¬μ°κΈ°) depthλ₯Ό μ€μ΄λ μ’μ λ°©λ²μ ν¨μ(λλ λ©μλ)λ₯Ό λΆλ¦¬νλ©΄ λλ€.
-- **ν¨μ(λλ λ©μλ)μ κΈΈμ΄κ° 15λΌμΈμ λμ΄κ°μ§ μλλ‘ κ΅¬ννλ€.**
- - ν¨μ(λλ λ©μλ)κ° ν κ°μ§ μΌλ§ μ νλλ‘ κ΅¬ννλ€.
-- λ³μ μ μΈμ `var` λ₯Ό μ¬μ©νμ§ μλλ€. `const` μ `let` μ μ¬μ©νλ€.
- - [const](https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Statements/const)
- - [let](https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Statements/let)
-- `import` λ¬Έμ μ΄μ©ν΄ μ€ν¬λ¦½νΈλ₯Ό λͺ¨λννκ³ λΆλ¬μ¬ μ μκ² λ§λ λ€.
- - [https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Statements/import](https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Statements/import)
-- `template literal`μ μ΄μ©ν΄ λ°μ΄ν°μ html stringμ κ°λ
μ± μ’κ² νννλ€.
- - [https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Template_literals](https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Template_literals)
-
-### μΆκ°λ μꡬμ¬ν
-- [data](https://developer.mozilla.org/ko/docs/Learn/HTML/Howto/%EB%8D%B0%EC%9D%B4%ED%84%B0_%EC%86%8D%EC%84%B1_%EC%82%AC%EC%9A%A9%ED%95%98%EA%B8%B0)μμ±μ νμ©νμ¬ html νκ·Έμ μ, λ
Έμ , ꡬκ°μ μ μΌν λ°μ΄ν° κ°λ€μ κ΄λ¦¬νλ€.
-- [localStorage](https://developer.mozilla.org/ko/docs/Web/API/Window/localStorage)λ₯Ό μ΄μ©νμ¬, μλ‘κ³ μΉ¨νλλΌλ κ°μ₯ μ΅κ·Όμ μμ
ν μ 보λ€μ λΆλ¬μ¬ μ μλλ‘ νλ€.
-
-
-
-## π λ―Έμ
μ μ₯μ λ° μ§ν μꡬμ¬ν
-
-- λ―Έμ
μ [https://github.com/woowacourse/javascript-subway-map-precours](https://github.com/woowacourse/javascript-subway-map-precourse) μ μ₯μλ₯Ό fork/cloneν΄ μμνλ€.
-- **κΈ°λ₯μ ꡬννκΈ° μ μ javascript-subway-precourse/docs/README.md νμΌμ ꡬνν κΈ°λ₯ λͺ©λ‘**μ μ λ¦¬ν΄ μΆκ°νλ€.
-- **gitμ commit λ¨μλ μ λ¨κ³μμ README.md νμΌμ μ 리ν κΈ°λ₯ λͺ©λ‘ λ¨μλ‘ μΆκ°**νλ€.
-- [ν리μ½μ€ κ³Όμ μ μΆ](https://github.com/woowacourse/woowacourse-docs/tree/master/precourse) λ¬Έμ μ μ°¨λ₯Ό λ°λΌ λ―Έμ
μ μ μΆνλ€.
+10. μ¬μ©μ λ
Έμ μ μν μ’
μ λΆν° νν μ’
μ κΉμ§ μ°κ²°λ μμλλ‘ μ 체 λ
Έμ κ³Ό μ λͺ©λ‘μ μ‘°νν μ μλ€.
From 5043ffe5403cf626a2e03d645c8eb268c546f5c2 Mon Sep 17 00:00:00 2001
From: devhyun637 <59258239+devhyun637@users.noreply.github.com>
Date: Mon, 14 Dec 2020 12:23:52 +0900
Subject: [PATCH 02/48] =?UTF-8?q?chore=20:=20gitignore=20=ED=8C=8C?=
=?UTF-8?q?=EC=9D=BC=20=EC=83=9D=EC=84=B1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.gitignore | 2 ++
1 file changed, 2 insertions(+)
create mode 100644 .gitignore
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000000000..ae7194bd3
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+.ieda
+.DS_Store
From 7821a1cb7c69ceeddb1bc45d71ee8a4aacba43e6 Mon Sep 17 00:00:00 2001
From: devhyun637 <59258239+devhyun637@users.noreply.github.com>
Date: Mon, 14 Dec 2020 12:24:11 +0900
Subject: [PATCH 03/48] =?UTF-8?q?chore=20:=20eslint=20=EC=84=A4=EC=A0=95?=
=?UTF-8?q?=20=ED=8C=8C=EC=9D=BC=20=EC=83=9D=EC=84=B1=20=EB=B0=8F=20?=
=?UTF-8?q?=EC=A0=81=EC=9A=A9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.eslintrc.json | 26 ++++++++++++++++++++++++++
1 file changed, 26 insertions(+)
create mode 100644 .eslintrc.json
diff --git a/.eslintrc.json b/.eslintrc.json
new file mode 100644
index 000000000..ee22f13cf
--- /dev/null
+++ b/.eslintrc.json
@@ -0,0 +1,26 @@
+{
+ "env": {
+ "browser": true,
+ "es2021": true,
+ "node": true
+ },
+ "extends": [
+ "eslint:recommended",
+ "airbnb-base",
+ "prettier"
+ ],
+ "parserOptions": {
+ "ecmaVersion": 2015,
+ "sourceType": "module"
+ },
+ "rules": {
+ "no-console": "off",
+ "no-plusplus": "off",
+ "class-methods-use-this": "off",
+ "radix": "off",
+ "no-restricted-properties": "off",
+ "max-depth" : ["error", 2],
+ "no-return-assign" : "off",
+ "no-continue" : "off"
+ }
+}
From 91181d61e0c3848155af9d2974eed848d42b1067 Mon Sep 17 00:00:00 2001
From: devhyun637 <59258239+devhyun637@users.noreply.github.com>
Date: Mon, 14 Dec 2020 12:24:26 +0900
Subject: [PATCH 04/48] =?UTF-8?q?chore=20:=20prettier=20=EC=84=A4=EC=A0=95?=
=?UTF-8?q?=20=ED=8C=8C=EC=9D=BC=20=EC=83=9D=EC=84=B1=20=EB=B0=8F=20?=
=?UTF-8?q?=EC=A0=81=EC=9A=A9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.prettierrc | 8 ++++++++
1 file changed, 8 insertions(+)
create mode 100644 .prettierrc
diff --git a/.prettierrc b/.prettierrc
new file mode 100644
index 000000000..13a6d0595
--- /dev/null
+++ b/.prettierrc
@@ -0,0 +1,8 @@
+{
+ "singleQuote": true,
+ "printWidth": 100,
+ "tabWidth": 2,
+ "useTabs": false,
+ "semi": true,
+ "arrowParens": "always"
+}
From 3e8a068b73f01b8dbbbcfd1817742881351fa4db Mon Sep 17 00:00:00 2001
From: devhyun637 <59258239+devhyun637@users.noreply.github.com>
Date: Mon, 14 Dec 2020 13:07:44 +0900
Subject: [PATCH 05/48] =?UTF-8?q?feat=20:=20'=EC=97=AD=20=EA=B4=80?=
=?UTF-8?q?=EB=A6=AC',=20'=EB=85=B8=EC=84=A0=20=EA=B4=80=EB=A6=AC',=20'?=
=?UTF-8?q?=EA=B5=AC=EA=B0=84=20=EA=B4=80=EB=A6=AC',=20'=EC=A7=80=ED=95=98?=
=?UTF-8?q?=EC=B2=A0=20=EB=85=B8=EC=84=A0=EB=8F=84=20=EC=B6=9C=EB=A0=A5'?=
=?UTF-8?q?=20=EB=B2=84=ED=8A=BC=20=EA=B5=AC=ED=98=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
index.html | 20 ++++++++++++++++++++
src/index.js | 4 ++++
src/subwayMapApp.js | 24 ++++++++++++++++++++++++
3 files changed, 48 insertions(+)
create mode 100644 src/subwayMapApp.js
diff --git a/index.html b/index.html
index fc99deac2..d87b907e5 100644
--- a/index.html
+++ b/index.html
@@ -3,10 +3,30 @@
μ§νμ² λ
Έμ λ κ΄λ¦¬
+
π μ§νμ² λ
Έμ λ κ΄λ¦¬
+
diff --git a/src/index.js b/src/index.js
index e69de29bb..646aeb386 100644
--- a/src/index.js
+++ b/src/index.js
@@ -0,0 +1,4 @@
+import subwayMapApp from './subwayMapApp.js';
+
+const $app = document.querySelector('#app');
+subwayMapApp($app);
diff --git a/src/subwayMapApp.js b/src/subwayMapApp.js
new file mode 100644
index 000000000..40af7055c
--- /dev/null
+++ b/src/subwayMapApp.js
@@ -0,0 +1,24 @@
+export default function subwayMapApp($element) {
+ const $stationManagerBtn = $element.querySelector('#station-manager-button');
+ const $lineManagerBtn = $element.querySelector('#line-manager-button');
+ const $sectionManagerBtn = $element.querySelector('#section-manager-button');
+ const $mapPrintManagerBtn = $element.querySelector('#map-print-manager-button');
+
+ const onStationManageHandler = () => {
+ console.log('μκ΄λ¦¬ μ
λλ€.');
+ };
+ const onLineManageHandler = () => {
+ console.log('λΌμΈκ΄λ¦¬ μ
λλ€.');
+ };
+ const onSectionManageHandler = () => {
+ console.log('λ
Έμ κ΄λ¦¬ μ
λλ€.');
+ };
+ const onMapPrintManageHandler = () => {
+ console.log('μ 체 λ
Έμ λ μΆλ ₯ μ
λλ€.');
+ };
+
+ $stationManagerBtn.addEventListener('click', onStationManageHandler);
+ $lineManagerBtn.addEventListener('click', onLineManageHandler);
+ $sectionManagerBtn.addEventListener('click', onSectionManageHandler);
+ $mapPrintManagerBtn.addEventListener('click', onMapPrintManageHandler);
+}
From 572997538cc46f3d650c2de1446d6c499542bbc7 Mon Sep 17 00:00:00 2001
From: devhyun637 <59258239+devhyun637@users.noreply.github.com>
Date: Mon, 14 Dec 2020 17:23:35 +0900
Subject: [PATCH 06/48] =?UTF-8?q?feat=20:=20=EC=82=AC=EC=9A=A9=EC=9E=90?=
=?UTF-8?q?=EB=8A=94=20=EC=97=AD=EC=9D=84=20=EB=93=B1=EB=A1=9D=ED=95=98?=
=?UTF-8?q?=EB=8A=94=20=EA=B8=B0=EB=8A=A5=20=EA=B5=AC=ED=98=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- μκ΄λ¦¬ templete ꡬν
- contentλ₯Ό νμν section νκ·Έ μμ±
- Station κ°μ²΄ μμ±
- μ¬μ©μκ° stationμ μ
λ ₯νλ©΄ λ±λ‘νλ κΈ°λ₯ ꡬν
- localStorageμ λ±λ‘ν station μ μ₯νλ κΈ°λ₯ ꡬν
- μ€λ³΅λ μ΄λ¦ λ° κΈμ μ μμΈμ²λ¦¬
---
index.html | 6 ++++
src/components/stationManagerPage.js | 44 ++++++++++++++++++++++++++++
src/subwayMapApp.js | 10 +++++--
src/utils/Station.js | 13 ++++++++
src/utils/constant.js | 3 ++
src/utils/stationStorage.js | 20 +++++++++++++
src/utils/templete.js | 26 ++++++++++++++++
7 files changed, 119 insertions(+), 3 deletions(-)
create mode 100644 src/components/stationManagerPage.js
create mode 100644 src/utils/Station.js
create mode 100644 src/utils/constant.js
create mode 100644 src/utils/stationStorage.js
create mode 100644 src/utils/templete.js
diff --git a/index.html b/index.html
index d87b907e5..c71f72567 100644
--- a/index.html
+++ b/index.html
@@ -4,6 +4,11 @@
μ§νμ² λ
Έμ λ κ΄λ¦¬
From 58d1f66cb4ab11eaa93f644dffdc7ee2acbd8e8b Mon Sep 17 00:00:00 2001
From: devhyun637 <59258239+devhyun637@users.noreply.github.com>
Date: Tue, 15 Dec 2020 02:54:19 +0900
Subject: [PATCH 18/48] =?UTF-8?q?docs=20:=20=EB=85=B8=EC=84=A0=20=EA=B4=80?=
=?UTF-8?q?=EB=A0=A8=20=EA=B8=B0=EB=8A=A5=20=EC=98=88=EC=99=B8=EC=B2=98?=
=?UTF-8?q?=EB=A6=AC=20=EC=B6=94=EA=B0=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/README.md b/README.md
index a68c94b37..112f2b8bd 100644
--- a/README.md
+++ b/README.md
@@ -17,7 +17,9 @@
- [쑰건] λ
Έμ λ±λ‘ μ μν μ’
μ μκ³Ό νν μ’
μ μμ μ
λ ₯λ°λλ€.
- [μμΈμ²λ¦¬] μ€λ³΅λ λ
Έμ μ΄λ¦μ΄ μλμ§ κ²μ¦ν΄μΌ νλ€.
- [μμΈμ²λ¦¬] ~μ ννμ μ΄λ¦μΈμ§ κ²μ¦ν΄μΌ νλ€.
- - [μμΈμ²λ¦¬] μμμ κ³Ό λμ μ΄ κ°μ λ
Έμ μ΄ μλμ§ κ²μ¦ν΄μΌ νλ€.
+ - [μμΈμ²λ¦¬] μμ μ’
μ κ³Ό νν μ’
μ μ΄ κ°μ λ
Έμ μ λ±λ‘ν μ μλ€.
+ - [μμΈμ²λ¦¬] μν μ’
μ κ³Ό νν μ’
μ μ΄ λμΌν κΈ°μ‘΄μ λ
Έμ μ΄ μλμ§ κ²μ¦ν΄μΌ νλ€.
+ - [μμΈμ²λ¦¬] λ
Έμ μ΄λ¦μ 무쑰건 μ
λ ₯ν΄μΌ νλ€.
6. μ¬μ©μλ μ§νμ² λ
Έμ μ μμ ν μ μλ€.
7. μ¬μ©μλ μ§νμ² λ
Έμ μ λͺ©λ‘μ μ‘°νν μ μλ€.
From c5b1472fd15888c0ef1fce2ca2af0d5d37d8a95c Mon Sep 17 00:00:00 2001
From: devhyun637 <59258239+devhyun637@users.noreply.github.com>
Date: Tue, 15 Dec 2020 03:37:44 +0900
Subject: [PATCH 19/48] =?UTF-8?q?fix=20:=20=EB=8B=A4=EB=A5=B8=20=EB=85=B8?=
=?UTF-8?q?=EC=84=A0=EA=B3=BC=20=EB=8F=99=EC=9D=BC=ED=95=9C=20=EC=A2=85?=
=?UTF-8?q?=EC=A0=90=EC=9D=84=20=EA=B0=80=EC=A7=80=EC=A7=80=20=EC=95=8A?=
=?UTF-8?q?=EB=8F=84=EB=A1=9D=20=ED=95=98=EB=8A=94=20=EC=98=88=EC=99=B8?=
=?UTF-8?q?=EC=B2=98=EB=A6=AC=20=EC=88=98=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- lineStorageμμ μ’
μ stationλ§ κ°μ Έμ¬ μ μλλ‘ λ©μλ μΆκ°
- κ±°κΎΈλ‘ νμ λ μ’
μ μ΄ κ°μλ μμΈμ²λ¦¬ ν μ μλλ‘ λ©μλ μΆκ° ꡬν
---
src/components/lineManagerPage.js | 2 +-
src/utils/lineStorage.js | 18 ++++++++++++++
src/utils/validator/lineValidator.js | 36 +++++++++++++++++++---------
3 files changed, 44 insertions(+), 12 deletions(-)
diff --git a/src/components/lineManagerPage.js b/src/components/lineManagerPage.js
index 9680f281b..c5e0b4e03 100644
--- a/src/components/lineManagerPage.js
+++ b/src/components/lineManagerPage.js
@@ -60,7 +60,7 @@ export default function stationManagerPage($element) {
if (
lineNameValidator(lines, newLineName) &&
- lineStationsValidator(lines, startStationName, endStationName)
+ lineStationsValidator(startStationName, endStationName)
) {
createLine(newLineName, startStationName, endStationName);
}
diff --git a/src/utils/lineStorage.js b/src/utils/lineStorage.js
index d2f2454fd..4992056b4 100644
--- a/src/utils/lineStorage.js
+++ b/src/utils/lineStorage.js
@@ -13,8 +13,26 @@ export default function lineStorage() {
localStorage.setItem(LINE_STORAGE_NAME, JSON.stringify(line));
};
+ const getStartPoints = () => {
+ if (!localStorage.getItem(LINE_STORAGE_NAME)) {
+ return [];
+ }
+ const startPoints = localStorage.getItem(LINE_STORAGE_NAME);
+ return JSON.parse(startPoints).map((line) => line.stations[0]);
+ };
+
+ const getEndPoints = () => {
+ if (!localStorage.getItem(LINE_STORAGE_NAME)) {
+ return [];
+ }
+ const startPoints = localStorage.getItem(LINE_STORAGE_NAME);
+ return JSON.parse(startPoints).map((line) => line.stations[line.stations.length - 1]);
+ };
+
return {
getLine,
setLine,
+ getStartPoints,
+ getEndPoints,
};
}
diff --git a/src/utils/validator/lineValidator.js b/src/utils/validator/lineValidator.js
index 29f87ef54..e4591c45b 100644
--- a/src/utils/validator/lineValidator.js
+++ b/src/utils/validator/lineValidator.js
@@ -1,3 +1,5 @@
+import lineStorage from '../lineStorage.js';
+
const isEqualName = (lines, lineName) => {
if (lines.some((line) => line.name === lineName)) {
return alert('μ€λ³΅λ λ
Έμ μ΄λ¦μ
λλ€.');
@@ -26,16 +28,27 @@ const isEqualPoints = (startStationName, endStationName) => {
return true;
};
-const isEqualLine = (lines, startStationName, endStationName) => {
- const linesStations = lines.map((line) => line.stations);
- const linesPoints = linesStations.filter(
- (currentLineStations, index) => index === 0 || index === currentLineStations.length - 1
- );
+const isEqualLine = (startStationName, endStationName) => {
+ const startStations = lineStorage()
+ .getStartPoints()
+ .map((station) => station.name === startStationName);
+ const endStations = lineStorage()
+ .getEndPoints()
+ .map((station) => station.name === endStationName);
- const equalLine = linesPoints.filter(
- (currentLinePoint) =>
- currentLinePoint[0].name === startStationName && currentLinePoint[1].name === endStationName
- );
+ const equalLine = startStations.filter((station, index) => station && endStations[index]);
+ return equalLine.length !== 0 ? alert('λμΌν μ’
μ μ κ°μ§ λ
Έμ μ΄ μμ΅λλ€') : true;
+};
+
+const isEqualReverseLine = (startStationName, endStationName) => {
+ const endStations = lineStorage()
+ .getStartPoints()
+ .map((station) => station.name === endStationName);
+ const StartStations = lineStorage()
+ .getEndPoints()
+ .map((station) => station.name === startStationName);
+
+ const equalLine = StartStations.filter((station, index) => station && endStations[index]);
return equalLine.length !== 0 ? alert('λμΌν μ’
μ μ κ°μ§ λ
Έμ μ΄ μμ΅λλ€') : true;
};
@@ -43,10 +56,11 @@ function lineNameValidator(lines, lineName) {
return isEqualName(lines, lineName) && isNameNotNull(lineName) && isCorrectName(lineName);
}
-function lineStationsValidator(lines, startStationName, endStationName) {
+function lineStationsValidator(startStationName, endStationName) {
return (
isEqualPoints(startStationName, endStationName) &&
- isEqualLine(lines, startStationName, endStationName)
+ isEqualLine(startStationName, endStationName) &&
+ isEqualReverseLine(startStationName, endStationName)
);
}
From 7eced0bd0c6069c2462a6bac79b8f46a755ffe4b Mon Sep 17 00:00:00 2001
From: devhyun637 <59258239+devhyun637@users.noreply.github.com>
Date: Tue, 15 Dec 2020 03:41:22 +0900
Subject: [PATCH 20/48] =?UTF-8?q?refactor=20:=20=EC=BD=94=EB=93=9C=20?=
=?UTF-8?q?=EA=B0=84=EA=B2=B0=ED=95=98=EA=B2=8C=20=EC=88=98=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/utils/validator/lineValidator.js | 24 ++++++++----------------
1 file changed, 8 insertions(+), 16 deletions(-)
diff --git a/src/utils/validator/lineValidator.js b/src/utils/validator/lineValidator.js
index e4591c45b..707dc97c9 100644
--- a/src/utils/validator/lineValidator.js
+++ b/src/utils/validator/lineValidator.js
@@ -1,31 +1,23 @@
import lineStorage from '../lineStorage.js';
const isEqualName = (lines, lineName) => {
- if (lines.some((line) => line.name === lineName)) {
- return alert('μ€λ³΅λ λ
Έμ μ΄λ¦μ
λλ€.');
- }
- return true;
+ return lines.some((line) => line.name === lineName) ? alert('μ€λ³΅λ λ
Έμ μ΄λ¦μ
λλ€.') : true;
};
const isNameNotNull = (lineName) => {
- if (!lineName) {
- return alert('λ
Έμ μ΄λ¦μ μ
λ ₯ν΄μ£ΌμΈμ');
- }
- return true;
+ return !lineName ? alert('λ
Έμ μ΄λ¦μ μ
λ ₯ν΄μ£ΌμΈμ') : true;
};
const isCorrectName = (lineName) => {
- if (lineName.split('')[lineName.length - 1] !== 'μ ') {
- return alert("λ
Έμ μ μ΄λ¦μ 'μ 'μΌλ‘ λλμΌ ν©λλ€");
- }
- return true;
+ return lineName.split('')[lineName.length - 1] !== 'μ '
+ ? alert("λ
Έμ μ μ΄λ¦μ 'μ 'μΌλ‘ λλμΌ ν©λλ€")
+ : true;
};
const isEqualPoints = (startStationName, endStationName) => {
- if (startStationName === endStationName) {
- return alert('μν μ’
μ κ³Ό νν μ’
μ μ μλ‘ λ¬λΌμΌ ν©λλ€');
- }
- return true;
+ return startStationName === endStationName
+ ? alert('μν μ’
μ κ³Ό νν μ’
μ μ μλ‘ λ¬λΌμΌ ν©λλ€')
+ : true;
};
const isEqualLine = (startStationName, endStationName) => {
From efbfbd4842c0ab9d4b5f845e8c20b5139e304593 Mon Sep 17 00:00:00 2001
From: devhyun637 <59258239+devhyun637@users.noreply.github.com>
Date: Tue, 15 Dec 2020 03:58:34 +0900
Subject: [PATCH 21/48] =?UTF-8?q?feat=20:=20=EB=85=B8=EC=84=A0=EC=9D=84=20?=
=?UTF-8?q?=EC=82=AD=EC=A0=9C=ED=95=98=EB=8A=94=20=EA=B8=B0=EB=8A=A5=20?=
=?UTF-8?q?=EA=B5=AC=ED=98=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/lineManagerPage.js | 19 ++++++++++++++++++-
1 file changed, 18 insertions(+), 1 deletion(-)
diff --git a/src/components/lineManagerPage.js b/src/components/lineManagerPage.js
index c5e0b4e03..0d98abcd4 100644
--- a/src/components/lineManagerPage.js
+++ b/src/components/lineManagerPage.js
@@ -17,7 +17,7 @@ export default function stationManagerPage($element) {
const $lineTableBody = $element.querySelector('.line-table-tbody');
const stations = stationStorage().getStation();
- const lines = lineStorage().getLine();
+ let lines = lineStorage().getLine();
$startStation.innerHTML = ALL_STATION_OPTION_LIST(stations);
$endStation.innerHTML = ALL_STATION_OPTION_LIST(stations);
@@ -53,6 +53,22 @@ export default function stationManagerPage($element) {
addLine(newLine);
};
+ const deleteLine = (stationTag) => {
+ console.log(stationTag);
+ lines = lines.filter((line) => line.id !== parseInt(stationTag.id));
+ lineStorage().setLine(lines);
+ renderLines();
+ };
+
+ const onLineDeleteHandler = (e) => {
+ if (!e.target.classList.contains('line-delete-button')) {
+ return;
+ }
+ if (confirm('μ λ§λ‘ μμ νμκ² μ΅λκΉ?')) {
+ deleteLine(e.target.closest('tr'));
+ }
+ };
+
const onLineSubmitHandler = () => {
const newLineName = $userInputLine.value;
const startStationName = $startStation.value;
@@ -68,5 +84,6 @@ export default function stationManagerPage($element) {
};
$userLineSubmitBtn.addEventListener('click', onLineSubmitHandler);
+ $lineTableBody.addEventListener('click', onLineDeleteHandler);
renderLines();
}
From 3859a789566079cd278cfd9970287373d7a526c9 Mon Sep 17 00:00:00 2001
From: devhyun637 <59258239+devhyun637@users.noreply.github.com>
Date: Tue, 15 Dec 2020 04:05:26 +0900
Subject: [PATCH 22/48] =?UTF-8?q?refactor=20:=20template=20=ED=8C=8C?=
=?UTF-8?q?=EC=9D=BC=20=EB=B6=84=EB=A6=AC?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/lineManagerPage.js | 2 +-
src/components/stationManagerPage.js | 5 ++-
.../template/lineManagerTemplate.js} | 32 +------------------
.../template/stationManagerTemplate.js | 25 +++++++++++++++
4 files changed, 31 insertions(+), 33 deletions(-)
rename src/{utils/templete.js => components/template/lineManagerTemplate.js} (65%)
create mode 100644 src/components/template/stationManagerTemplate.js
diff --git a/src/components/lineManagerPage.js b/src/components/lineManagerPage.js
index 0d98abcd4..727cd0bdb 100644
--- a/src/components/lineManagerPage.js
+++ b/src/components/lineManagerPage.js
@@ -2,7 +2,7 @@ import {
LINE_MANAGER_PAGE_TEMPLATE,
ALL_STATION_OPTION_LIST,
LINE_TABLE_TEMPLATE,
-} from '../utils/templete.js';
+} from './template/lineManagerTemplate.js';
import { lineNameValidator, lineStationsValidator } from '../utils/validator/lineValidator.js';
import stationStorage from '../utils/stationStorage.js';
import lineStorage from '../utils/lineStorage.js';
diff --git a/src/components/stationManagerPage.js b/src/components/stationManagerPage.js
index 74ec373af..e57222bf6 100644
--- a/src/components/stationManagerPage.js
+++ b/src/components/stationManagerPage.js
@@ -1,4 +1,7 @@
-import { STATION_MANAGER_PAGE_TEMPLATE, STATION_TABLE_TEMPLATE } from '../utils/templete.js';
+import {
+ STATION_MANAGER_PAGE_TEMPLATE,
+ STATION_TABLE_TEMPLATE,
+} from './template/stationManagerTemplate.js';
import {
stationNameValidator,
stationDeleteValidation,
diff --git a/src/utils/templete.js b/src/components/template/lineManagerTemplate.js
similarity index 65%
rename from src/utils/templete.js
rename to src/components/template/lineManagerTemplate.js
index b7cf0be2a..f973e67ce 100644
--- a/src/utils/templete.js
+++ b/src/components/template/lineManagerTemplate.js
@@ -1,27 +1,3 @@
-const STATION_MANAGER_PAGE_TEMPLATE = `μ μ΄λ¦
-
-
-
-
- π μ§νμ² μ λͺ©λ‘
-
-
- | μ μ΄λ¦ |
- μ€μ |
-
-
-
-
-
-
`;
-
-const STATION_TABLE_TEMPLATE = (station) => {
- return `
- | ${station.name} |
- |
-
`;
-};
-
const LINE_MANAGER_PAGE_TEMPLATE = `
λ
Έμ μ΄λ¦
@@ -71,10 +47,4 @@ const LINE_TABLE_TEMPLATE = (lines) => {
`;
};
-export {
- STATION_MANAGER_PAGE_TEMPLATE,
- STATION_TABLE_TEMPLATE,
- LINE_MANAGER_PAGE_TEMPLATE,
- ALL_STATION_OPTION_LIST,
- LINE_TABLE_TEMPLATE,
-};
+export { LINE_MANAGER_PAGE_TEMPLATE, ALL_STATION_OPTION_LIST, LINE_TABLE_TEMPLATE };
diff --git a/src/components/template/stationManagerTemplate.js b/src/components/template/stationManagerTemplate.js
new file mode 100644
index 000000000..b6fdc37f9
--- /dev/null
+++ b/src/components/template/stationManagerTemplate.js
@@ -0,0 +1,25 @@
+const STATION_MANAGER_PAGE_TEMPLATE = `μ μ΄λ¦
+
+
+
+
+ π μ§νμ² μ λͺ©λ‘
+
+
+ | μ μ΄λ¦ |
+ μ€μ |
+
+
+
+
+
+
`;
+
+const STATION_TABLE_TEMPLATE = (station) => {
+ return `
+ | ${station.name} |
+ |
+
`;
+};
+
+export { STATION_MANAGER_PAGE_TEMPLATE, STATION_TABLE_TEMPLATE };
From 5f9b81e1574649c0486d861dd6c0d59a84d4a5fa Mon Sep 17 00:00:00 2001
From: devhyun637 <59258239+devhyun637@users.noreply.github.com>
Date: Tue, 15 Dec 2020 04:05:50 +0900
Subject: [PATCH 23/48] =?UTF-8?q?docs=20:=20README=20=EC=98=A4=ED=83=80=20?=
=?UTF-8?q?=EC=88=98=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 112f2b8bd..f402a1dad 100644
--- a/README.md
+++ b/README.md
@@ -25,7 +25,7 @@
### μ§νμ² κ΅¬κ° μΆκ° κΈ°λ₯
8. μ¬μ©μλ λ
Έμ μ μμ μΆκ°ν μ μλ€.
- - [μμΈμ²λ¦¬] μ€λ³΅λ λ
Έμ μ΄ μλμ§ κ²μ¦ν΄μΌ νλ€.
+ - [μμΈμ²λ¦¬] μ€λ³΅λ μμ΄ μλμ§ κ²μ¦ν΄μΌ νλ€.
- [쑰건] νλμ μμ μ¬λ¬κ°μ λ
Έμ μ μΆκ°λ μ μλ€.
- [쑰건] μκ³Ό μ μ¬μ΄μ μλ‘μ΄ μμ΄ μΆκ° λ μ μλ€.
- [쑰건] λ
Έμ μμ κ°λκΈΈμ μκΈΈ μ μλ€.
From 603b9a4d7505579a875953263ff6914fc8040b9b Mon Sep 17 00:00:00 2001
From: devhyun637 <59258239+devhyun637@users.noreply.github.com>
Date: Tue, 15 Dec 2020 04:50:15 +0900
Subject: [PATCH 24/48] =?UTF-8?q?refactor=20:=20=EC=BD=94=EB=93=9C=20?=
=?UTF-8?q?=EA=B0=84=EB=9E=B5=ED=95=98=EA=B2=8C=20=EB=A6=AC=ED=8C=A9?=
=?UTF-8?q?=ED=86=A0=EB=A7=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/utils/lineStorage.js | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)
diff --git a/src/utils/lineStorage.js b/src/utils/lineStorage.js
index 4992056b4..69dd888a1 100644
--- a/src/utils/lineStorage.js
+++ b/src/utils/lineStorage.js
@@ -14,19 +14,11 @@ export default function lineStorage() {
};
const getStartPoints = () => {
- if (!localStorage.getItem(LINE_STORAGE_NAME)) {
- return [];
- }
- const startPoints = localStorage.getItem(LINE_STORAGE_NAME);
- return JSON.parse(startPoints).map((line) => line.stations[0]);
+ return getLine().map((line) => line.stations[0]);
};
const getEndPoints = () => {
- if (!localStorage.getItem(LINE_STORAGE_NAME)) {
- return [];
- }
- const startPoints = localStorage.getItem(LINE_STORAGE_NAME);
- return JSON.parse(startPoints).map((line) => line.stations[line.stations.length - 1]);
+ return getLine().map((line) => line.stations[line.stations.length - 1]);
};
return {
From b2663733edebdde3386fdb71fb048767808e765f Mon Sep 17 00:00:00 2001
From: devhyun637 <59258239+devhyun637@users.noreply.github.com>
Date: Tue, 15 Dec 2020 05:37:23 +0900
Subject: [PATCH 25/48] =?UTF-8?q?docs=20:=20=EA=B8=B0=EB=8A=A5=20=EA=B5=AC?=
=?UTF-8?q?=ED=98=84=20=EB=AA=A9=EB=A1=9D=20=EC=97=85=EB=8D=B0=EC=9D=B4?=
=?UTF-8?q?=ED=8A=B8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
README.md | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/README.md b/README.md
index f402a1dad..a7a818659 100644
--- a/README.md
+++ b/README.md
@@ -23,17 +23,16 @@
6. μ¬μ©μλ μ§νμ² λ
Έμ μ μμ ν μ μλ€.
7. μ¬μ©μλ μ§νμ² λ
Έμ μ λͺ©λ‘μ μ‘°νν μ μλ€.
-### μ§νμ² κ΅¬κ° μΆκ° κΈ°λ₯
+### μ§νμ² κ΅¬κ° κ΄λ ¨ κΈ°λ₯
8. μ¬μ©μλ λ
Έμ μ μμ μΆκ°ν μ μλ€.
- [μμΈμ²λ¦¬] μ€λ³΅λ μμ΄ μλμ§ κ²μ¦ν΄μΌ νλ€.
- [쑰건] νλμ μμ μ¬λ¬κ°μ λ
Έμ μ μΆκ°λ μ μλ€.
- [쑰건] μκ³Ό μ μ¬μ΄μ μλ‘μ΄ μμ΄ μΆκ° λ μ μλ€.
- [쑰건] λ
Έμ μμ κ°λκΈΈμ μκΈΈ μ μλ€.
-
-### μ§νμ² κ΅¬κ° μμ κΈ°λ₯
9. μ¬μ©μλ λ
Έμ μ μμ μμ ν μ μλ€.
- [μμΈμ²λ¦¬] λ
Έμ μ μμ΄ 2κ° μ΄νμΈμ§ κ²μ¦νκ³ , 2κ° μ΄νλ©΄ μμ ν μ μλ€.
- [쑰건] μ’
μ μ μ κ±°ν κ²½μ° λ€μ μμ΄ μ’
μ μ΄ λλ€.
+10. μ¬μ©μλ λ
Έμ λ³λ‘ μμ λͺ©λ‘μ λ³Ό μ μλ€.
### μ§νμ² λ
Έμ μ λ±λ‘λ μ μ‘°ν κΈ°λ₯
-10. μ¬μ©μ λ
Έμ μ μν μ’
μ λΆν° νν μ’
μ κΉμ§ μ°κ²°λ μμλλ‘ μ 체 λ
Έμ κ³Ό μ λͺ©λ‘μ μ‘°νν μ μλ€.
+11. μ¬μ©μ λ
Έμ μ μν μ’
μ λΆν° νν μ’
μ κΉμ§ μ°κ²°λ μμλλ‘ μ 체 λ
Έμ κ³Ό μ λͺ©λ‘μ μ‘°νν μ μλ€.
From dfcddd016fe77eabaa3aef5d121694a4371f7818 Mon Sep 17 00:00:00 2001
From: devhyun637 <59258239+devhyun637@users.noreply.github.com>
Date: Tue, 15 Dec 2020 05:40:09 +0900
Subject: [PATCH 26/48] =?UTF-8?q?feat=20:=20=EB=85=B8=EC=84=A0=20=EB=B3=84?=
=?UTF-8?q?=EB=A1=9C=20=EC=97=AD=EC=9D=98=20=EB=AA=A9=EB=A1=9D=EC=9D=84=20?=
=?UTF-8?q?=EB=B3=BC=20=EC=88=98=20=EC=9E=88=EB=8A=94=20=EA=B8=B0=EB=8A=A5?=
=?UTF-8?q?=20=EA=B5=AC=ED=98=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- κ΅¬κ° λ±λ‘ νλ©΄ template ꡬν
- μ¬μ©μκ° λ
Έμ μ μ ννλ©΄ λ
Έμ μ κ΅¬κ° λͺ©λ‘ ν
μ΄λΈμ λ³Ό μ μλλ‘ κ΅¬ν
- localStorageμ νκ°μ λ
Έμ λ§ κ°μ Έμ€λ κΈ°λ₯ ꡬν
---
src/components/sectionManagerPage.js | 42 ++++++++++++++++
.../template/sectionManagerTemplate.js | 48 +++++++++++++++++++
src/subwayMapApp.js | 3 +-
src/utils/lineStorage.js | 5 ++
4 files changed, 97 insertions(+), 1 deletion(-)
create mode 100644 src/components/sectionManagerPage.js
create mode 100644 src/components/template/sectionManagerTemplate.js
diff --git a/src/components/sectionManagerPage.js b/src/components/sectionManagerPage.js
new file mode 100644
index 000000000..ab6f925d7
--- /dev/null
+++ b/src/components/sectionManagerPage.js
@@ -0,0 +1,42 @@
+import {
+ SECTION_MANAGER_PAGE_MENU_TEMPLATE,
+ SECTION_MANAGER_PAGE_SELECTOR_TEMPLATE,
+ SECTION_MANAGER_PAGE_TABLE_TEMPLATE,
+ SECTION_LINE_MENU_BTN,
+ SECTION_TABLE_TEMPLATE,
+} from './template/sectionManagerTemplate.js';
+import lineStorage from '../utils/lineStorage.js';
+import stationStorage from '../utils/stationStorage.js';
+import { ALL_STATION_OPTION_LIST } from './template/lineManagerTemplate.js';
+
+export default function sectionManagerPage($element) {
+ const lines = lineStorage().getLine();
+ const stations = stationStorage().getStation();
+
+ $element.innerHTML = SECTION_MANAGER_PAGE_MENU_TEMPLATE;
+ const $listMenuBtn = $element.querySelector('.line-buttons');
+ $listMenuBtn.innerHTML = lines.map(SECTION_LINE_MENU_BTN).join('');
+ const $sectionSelectorContainer = $element.querySelector('#section-selector-container');
+ const $lineTitle = $element.querySelector('#line-title');
+
+ const renderSectionManager = (currentLine) => {
+ $lineTitle.innerText = `${currentLine.name} κ΄λ¦¬`;
+ $sectionSelectorContainer.innerHTML = SECTION_MANAGER_PAGE_SELECTOR_TEMPLATE;
+ const $sectionSelector = $element.querySelector('#section-station-selector');
+ const $sectionTable = $element.querySelector('#section-table');
+ $sectionSelector.innerHTML = ALL_STATION_OPTION_LIST(stations);
+ $sectionTable.innerHTML = SECTION_MANAGER_PAGE_TABLE_TEMPLATE;
+ const $sectionTableBody = $element.querySelector('.section-table-tbody');
+ $sectionTableBody.innerHTML = SECTION_TABLE_TEMPLATE(currentLine);
+ };
+
+ const onMenuFilterHandler = (e) => {
+ if (!e.target.classList.contains('section-line-menu-button')) {
+ return;
+ }
+ const currentLine = lineStorage().getOneLine(e.target.dataset.lineid);
+ renderSectionManager(currentLine);
+ };
+
+ $listMenuBtn.addEventListener('click', onMenuFilterHandler);
+}
diff --git a/src/components/template/sectionManagerTemplate.js b/src/components/template/sectionManagerTemplate.js
new file mode 100644
index 000000000..decf94dc9
--- /dev/null
+++ b/src/components/template/sectionManagerTemplate.js
@@ -0,0 +1,48 @@
+const SECTION_MANAGER_PAGE_MENU_TEMPLATE = `
+
+ `;
+
+const SECTION_MANAGER_PAGE_SELECTOR_TEMPLATE = `κ΅¬κ° λ±λ‘
+
+
+ `;
+
+const SECTION_MANAGER_PAGE_TABLE_TEMPLATE = `
+
+
+ | μμ |
+ μ΄λ¦ |
+ μ€μ |
+
+
+
+
`;
+
+const SECTION_TABLE_TEMPLATE = ({ id, stations }) => {
+ return stations
+ .map(
+ (station, index) =>
+ `
+ | ${index} |
+ ${station.name} |
+ |
+
`
+ )
+ .join('');
+};
+
+const SECTION_LINE_MENU_BTN = (line) => {
+ return ``;
+};
+
+export {
+ SECTION_MANAGER_PAGE_MENU_TEMPLATE,
+ SECTION_MANAGER_PAGE_SELECTOR_TEMPLATE,
+ SECTION_MANAGER_PAGE_TABLE_TEMPLATE,
+ SECTION_LINE_MENU_BTN,
+ SECTION_TABLE_TEMPLATE,
+};
diff --git a/src/subwayMapApp.js b/src/subwayMapApp.js
index ca45e56c7..e5d096bae 100644
--- a/src/subwayMapApp.js
+++ b/src/subwayMapApp.js
@@ -1,5 +1,6 @@
import stationManagerPage from './components/stationManagerPage.js';
import lineManagerPage from './components/lineManagerPage.js';
+import sectionManagerPage from './components/sectionManagerPage.js';
export default function subwayMapApp($element) {
const $stationManagerBtn = $element.querySelector('#station-manager-button');
@@ -15,7 +16,7 @@ export default function subwayMapApp($element) {
lineManagerPage($contentSection);
};
const onSectionManageHandler = () => {
- console.log('ꡬκ°κ΄λ¦¬ μ
λλ€.');
+ sectionManagerPage($contentSection);
};
const onMapPrintManageHandler = () => {
console.log('μ 체 λ
Έμ λ μΆλ ₯ μ
λλ€.');
diff --git a/src/utils/lineStorage.js b/src/utils/lineStorage.js
index 69dd888a1..9c96fa272 100644
--- a/src/utils/lineStorage.js
+++ b/src/utils/lineStorage.js
@@ -21,10 +21,15 @@ export default function lineStorage() {
return getLine().map((line) => line.stations[line.stations.length - 1]);
};
+ const getOneLine = (lineId) => {
+ return getLine().filter((line) => line.id === parseInt(lineId))[0];
+ };
+
return {
getLine,
setLine,
getStartPoints,
getEndPoints,
+ getOneLine,
};
}
From 1cd523974988070f291b4cdc14f83027653cfba8 Mon Sep 17 00:00:00 2001
From: devhyun637 <59258239+devhyun637@users.noreply.github.com>
Date: Tue, 15 Dec 2020 05:40:21 +0900
Subject: [PATCH 27/48] =?UTF-8?q?style=20:=20=20html=20=EC=8A=A4=ED=83=80?=
=?UTF-8?q?=EC=9D=BC=20=EC=B6=94=EA=B0=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
index.html | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/index.html b/index.html
index ed6d4b063..3012bea43 100644
--- a/index.html
+++ b/index.html
@@ -14,9 +14,17 @@
color: black;
}
+ button {
+ margin-left : 0.2rem;
+ }
+
.select-line-points {
margin: 1rem 0;
}
+
+ #section-selector-container{
+ margin-bottom: 2rem;
+ }
From abf48efb8add1f96e031670dfa02efc2833f35f1 Mon Sep 17 00:00:00 2001
From: devhyun637 <59258239+devhyun637@users.noreply.github.com>
Date: Tue, 15 Dec 2020 16:28:31 +0900
Subject: [PATCH 28/48] =?UTF-8?q?refactor=20:=20=EC=82=AC=EC=9A=A9?=
=?UTF-8?q?=ED=95=98=EC=A7=80=20=EC=95=8A=EB=8A=94=20=EB=A9=94=EC=86=8C?=
=?UTF-8?q?=EB=93=9C=20=EC=82=AD=EC=A0=9C?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/utils/Station.js | 8 --------
1 file changed, 8 deletions(-)
diff --git a/src/utils/Station.js b/src/utils/Station.js
index 38981c886..07c1baf13 100644
--- a/src/utils/Station.js
+++ b/src/utils/Station.js
@@ -2,12 +2,4 @@ export default function Station(id, name) {
this.id = id;
this.name = name;
this.line = [];
-
- this.setLine = (lineName) => {
- if (this.line.includes(lineName)) {
- alert(`${lineName}μ μ΄λ―Έ ${name}μμ΄ ν¬ν¨λμ΄ μμ΅λλ€.`);
- } else {
- this.line.push(lineName);
- }
- };
}
From 10706542412be4152c48a56be2afae4a8d8bc03a Mon Sep 17 00:00:00 2001
From: devhyun637 <59258239+devhyun637@users.noreply.github.com>
Date: Tue, 15 Dec 2020 16:29:33 +0900
Subject: [PATCH 29/48] =?UTF-8?q?feat=20:=20station=20localstorag=EC=97=90?=
=?UTF-8?q?=EC=84=9C=20id=EC=99=80=20=EC=9D=B4=EB=A6=84=EC=9C=BC=EB=A1=9C?=
=?UTF-8?q?=20station,=20id=20=EA=B0=80=EC=A7=80=EA=B3=A0=20=EC=98=A4?=
=?UTF-8?q?=EB=8A=94=20=EB=A9=94=EC=86=8C=EB=93=9C=20=EA=B5=AC=ED=98=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/utils/stationStorage.js | 14 ++++++++++++--
1 file changed, 12 insertions(+), 2 deletions(-)
diff --git a/src/utils/stationStorage.js b/src/utils/stationStorage.js
index dd818caed..5ea458c16 100644
--- a/src/utils/stationStorage.js
+++ b/src/utils/stationStorage.js
@@ -1,7 +1,7 @@
import { STATION_STORAGE_NAME } from './constant.js';
export default function stationStorage() {
- const getStation = () => {
+ const getStations = () => {
if (!localStorage.getItem(STATION_STORAGE_NAME)) {
return [];
}
@@ -13,8 +13,18 @@ export default function stationStorage() {
localStorage.setItem(STATION_STORAGE_NAME, JSON.stringify(station));
};
+ const getStationIdByName = (stationName) => {
+ return getStations().filter((station) => station.name === stationName)[0].id;
+ };
+
+ const getStationIdById = (stationId) => {
+ return getStations().filter((station) => station.id === stationId)[0];
+ };
+
return {
- getStation,
+ getStations,
setStation,
+ getStationIdByName,
+ getStationIdById,
};
}
From faa4e32ec448be17c71fa4d2d050de648ef6eaea Mon Sep 17 00:00:00 2001
From: devhyun637 <59258239+devhyun637@users.noreply.github.com>
Date: Tue, 15 Dec 2020 16:29:52 +0900
Subject: [PATCH 30/48] =?UTF-8?q?refactor=20:=20=EB=A9=94=EC=86=8C?=
=?UTF-8?q?=EB=93=9C=20=EB=AA=85=20=EC=88=98=EC=A0=95=ED=95=9C=EA=B1=B0=20?=
=?UTF-8?q?=EC=A0=81=EC=9A=A9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/stationManagerPage.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/components/stationManagerPage.js b/src/components/stationManagerPage.js
index e57222bf6..c43e32225 100644
--- a/src/components/stationManagerPage.js
+++ b/src/components/stationManagerPage.js
@@ -15,7 +15,7 @@ export default function stationManagerPage($element) {
const $userStationSubmit = $element.querySelector('#station-add-button');
const $stationTablebody = $element.querySelector('.station_manager_tbody');
- let stations = stationStorage().getStation();
+ let stations = stationStorage().getStations();
const showStations = () => {
$stationTablebody.innerHTML = stations.map(STATION_TABLE_TEMPLATE).join('');
From 24da4655273396e09ef05c5907b03d3f81044ec5 Mon Sep 17 00:00:00 2001
From: devhyun637 <59258239+devhyun637@users.noreply.github.com>
Date: Tue, 15 Dec 2020 16:32:45 +0900
Subject: [PATCH 31/48] =?UTF-8?q?refactor=20:=20line=20storage=20=EC=86=8D?=
=?UTF-8?q?=EC=84=B1=20=EB=B3=80=EA=B2=BD=20=EB=B0=8F=20=EB=85=B8=EC=84=A0?=
=?UTF-8?q?=20=EC=82=AD=EC=A0=9C,=EB=93=B1=EB=A1=9D=20=EB=A1=9C=EC=A7=81?=
=?UTF-8?q?=20=EC=88=98=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- line storageμμ station λͺ¨λλ₯Ό κ°μ§κ³ μλ κ²μμ idλ§ κ°μ§κ³ μκ² μμ
- λ
Έμ μ λ±λ‘νκ³ μμ ν λ, station storageμ μ μ©μλλ κ² μ μ©λκ² μμ
---
src/components/lineManagerPage.js | 45 ++++++++++++++-----
.../template/lineManagerTemplate.js | 19 +++++---
src/utils/Line.js | 9 ++--
src/utils/lineStorage.js | 12 ++---
src/utils/validator/lineValidator.js | 39 +++++++++-------
5 files changed, 80 insertions(+), 44 deletions(-)
diff --git a/src/components/lineManagerPage.js b/src/components/lineManagerPage.js
index 727cd0bdb..db33ab3f7 100644
--- a/src/components/lineManagerPage.js
+++ b/src/components/lineManagerPage.js
@@ -16,7 +16,7 @@ export default function stationManagerPage($element) {
const $userLineSubmitBtn = $element.querySelector('#line-add-button');
const $lineTableBody = $element.querySelector('.line-table-tbody');
- const stations = stationStorage().getStation();
+ const stations = stationStorage().getStations();
let lines = lineStorage().getLine();
$startStation.innerHTML = ALL_STATION_OPTION_LIST(stations);
@@ -40,22 +40,45 @@ export default function stationManagerPage($element) {
};
const getStation = (stationName) => {
- return stations.filter((station) => station.name === stationName);
+ return stations.filter((station) => station.name === stationName)[0];
};
- const createLine = (newLineName, startStationName, endStationName) => {
- const startStation = getStation(startStationName)[0];
- const endStation = getStation(endStationName)[0];
+ const getStationById = (stationIds) => {
+ return stations.filter((station) => station.id === stationIds)[0];
+ };
+ const addLineInStation = (lineId, stationName) => {
+ getStation(stationName).line.push(lineId);
+ stationStorage().setStation(stations);
+ };
+
+ const createLine = (newLineName, startStationName, endStationName) => {
+ const startStationId = stationStorage().getStationIdByName(startStationName);
+ const endStationId = stationStorage().getStationIdByName(endStationName);
const newLine = new Line(getNewId(), newLineName);
- newLine.setLine(startStation, 0);
- newLine.setLine(endStation, 1);
+ newLine.setLine(startStationId, 0);
+ newLine.setLine(endStationId, 1);
+
+ addLineInStation(newLine.id, startStationName);
+ addLineInStation(newLine.id, endStationName);
addLine(newLine);
};
- const deleteLine = (stationTag) => {
- console.log(stationTag);
- lines = lines.filter((line) => line.id !== parseInt(stationTag.id));
+ const removeLineInStation = (currentLineId) => {
+ const stationIdsInLine = lines.filter((line) => line.id === parseInt(currentLineId))[0]
+ .stationIds;
+
+ const stationsInLine = stationIdsInLine.map(getStationById);
+ for (let i = 0; i < stationsInLine.length; i++) {
+ const deleteIndex = stationsInLine[i].line.indexOf(parseInt(currentLineId));
+ stationsInLine[i].line.splice(deleteIndex, 1);
+ }
+ stationStorage().setStation(stations);
+ };
+
+ const removeLine = (currentLineId) => {
+ removeLineInStation(currentLineId);
+ lines = lines.filter((line) => line.id !== parseInt(currentLineId));
lineStorage().setLine(lines);
renderLines();
};
@@ -65,7 +88,7 @@ export default function stationManagerPage($element) {
return;
}
if (confirm('μ λ§λ‘ μμ νμκ² μ΅λκΉ?')) {
- deleteLine(e.target.closest('tr'));
+ removeLine(e.target.closest('tr').id);
}
};
diff --git a/src/components/template/lineManagerTemplate.js b/src/components/template/lineManagerTemplate.js
index f973e67ce..a50ce5a1c 100644
--- a/src/components/template/lineManagerTemplate.js
+++ b/src/components/template/lineManagerTemplate.js
@@ -1,3 +1,5 @@
+import stationStorage from '../../utils/stationStorage.js';
+
const LINE_MANAGER_PAGE_TEMPLATE = `
λ
Έμ μ΄λ¦
@@ -36,13 +38,18 @@ const ALL_STATION_OPTION_LIST = (stations) => {
.join('');
};
-const LINE_TABLE_TEMPLATE = (lines) => {
- const lineLength = lines.stations.length;
+const LINE_TABLE_TEMPLATE = (line) => {
+ const lastStationId = line.stationIds[line.stationIds.length - 1];
+ const firstStationId = line.stationIds[0];
- return `
- | ${lines.name} |
- ${lines.stations[0].name} |
- ${lines.stations[lineLength - 1].name} |
+ return `
+ | ${line.name} |
+ ${
+ stationStorage().getStationIdById(firstStationId).name
+ } |
+ ${
+ stationStorage().getStationIdById(lastStationId).name
+ } |
|
`;
};
diff --git a/src/utils/Line.js b/src/utils/Line.js
index a2a3b703a..c82eb4369 100644
--- a/src/utils/Line.js
+++ b/src/utils/Line.js
@@ -1,13 +1,12 @@
export default function Line(id, name) {
this.id = id;
this.name = name;
- this.stations = [];
+ this.stationIds = [];
- this.setLine = (Station, index) => {
- const stationNames = this.stations.map((station) => station.name);
- if (stationNames.includes(Station)) {
+ this.setLine = (stationId, index) => {
+ if (this.stationIds.includes(stationId)) {
alert('μ΄λ―Έ λ±λ‘λμ΄ μμ΅λλ€');
}
- this.stations.splice(index, 0, Station);
+ this.stationIds.splice(index, 0, stationId);
};
}
diff --git a/src/utils/lineStorage.js b/src/utils/lineStorage.js
index 9c96fa272..9b33232d5 100644
--- a/src/utils/lineStorage.js
+++ b/src/utils/lineStorage.js
@@ -13,12 +13,12 @@ export default function lineStorage() {
localStorage.setItem(LINE_STORAGE_NAME, JSON.stringify(line));
};
- const getStartPoints = () => {
- return getLine().map((line) => line.stations[0]);
+ const getStartPointsId = () => {
+ return getLine().map((line) => line.stationIds[0]);
};
- const getEndPoints = () => {
- return getLine().map((line) => line.stations[line.stations.length - 1]);
+ const getEndPointsId = () => {
+ return getLine().map((line) => line.stationIds[line.stationIds.length - 1]);
};
const getOneLine = (lineId) => {
@@ -28,8 +28,8 @@ export default function lineStorage() {
return {
getLine,
setLine,
- getStartPoints,
- getEndPoints,
+ getStartPointsId,
+ getEndPointsId,
getOneLine,
};
}
diff --git a/src/utils/validator/lineValidator.js b/src/utils/validator/lineValidator.js
index 707dc97c9..d93acb6fc 100644
--- a/src/utils/validator/lineValidator.js
+++ b/src/utils/validator/lineValidator.js
@@ -1,4 +1,5 @@
import lineStorage from '../lineStorage.js';
+import stationStorage from '../stationStorage.js';
const isEqualName = (lines, lineName) => {
return lines.some((line) => line.name === lineName) ? alert('μ€λ³΅λ λ
Έμ μ΄λ¦μ
λλ€.') : true;
@@ -21,26 +22,32 @@ const isEqualPoints = (startStationName, endStationName) => {
};
const isEqualLine = (startStationName, endStationName) => {
- const startStations = lineStorage()
- .getStartPoints()
- .map((station) => station.name === startStationName);
- const endStations = lineStorage()
- .getEndPoints()
- .map((station) => station.name === endStationName);
-
- const equalLine = startStations.filter((station, index) => station && endStations[index]);
+ const startStationId = stationStorage().getStationIdByName(startStationName);
+ const endStationId = stationStorage().getStationIdByName(endStationName);
+
+ const startStationIds = lineStorage()
+ .getStartPointsId()
+ .map((stationId) => stationId === parseInt(startStationId));
+ const endStationIds = lineStorage()
+ .getEndPointsId()
+ .map((stationId) => stationId === parseInt(endStationId));
+
+ const equalLine = startStationIds.filter((station, index) => station && endStationIds[index]);
return equalLine.length !== 0 ? alert('λμΌν μ’
μ μ κ°μ§ λ
Έμ μ΄ μμ΅λλ€') : true;
};
const isEqualReverseLine = (startStationName, endStationName) => {
- const endStations = lineStorage()
- .getStartPoints()
- .map((station) => station.name === endStationName);
- const StartStations = lineStorage()
- .getEndPoints()
- .map((station) => station.name === startStationName);
-
- const equalLine = StartStations.filter((station, index) => station && endStations[index]);
+ const startStationId = stationStorage().getStationIdByName(startStationName);
+ const endStationId = stationStorage().getStationIdByName(endStationName);
+
+ const endStationsIds = lineStorage()
+ .getStartPointsId()
+ .map((stationId) => stationId === parseInt(startStationId));
+ const StartStationsIds = lineStorage()
+ .getEndPointsId()
+ .map((stationId) => stationId === parseInt(endStationId));
+
+ const equalLine = StartStationsIds.filter((station, index) => station && endStationsIds[index]);
return equalLine.length !== 0 ? alert('λμΌν μ’
μ μ κ°μ§ λ
Έμ μ΄ μμ΅λλ€') : true;
};
From 0553dcd1d8348737e477e39927def9b24f5d08cb Mon Sep 17 00:00:00 2001
From: devhyun637 <59258239+devhyun637@users.noreply.github.com>
Date: Tue, 15 Dec 2020 16:41:19 +0900
Subject: [PATCH 32/48] =?UTF-8?q?refatcor=20:=20=EB=B3=80=EC=88=98?=
=?UTF-8?q?=EB=AA=85=20=EC=9E=98=EB=AA=BB=EB=90=9C=20=EA=B2=83=20=EC=88=98?=
=?UTF-8?q?=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/template/lineManagerTemplate.js | 8 ++++----
src/utils/stationStorage.js | 4 ++--
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/components/template/lineManagerTemplate.js b/src/components/template/lineManagerTemplate.js
index a50ce5a1c..1255fc9c0 100644
--- a/src/components/template/lineManagerTemplate.js
+++ b/src/components/template/lineManagerTemplate.js
@@ -44,11 +44,11 @@ const LINE_TABLE_TEMPLATE = (line) => {
return `
| ${line.name} |
- ${
- stationStorage().getStationIdById(firstStationId).name
+ | ${
+ stationStorage().getStationById(firstStationId).name
} |
- ${
- stationStorage().getStationIdById(lastStationId).name
+ | ${
+ stationStorage().getStationById(lastStationId).name
} |
|
`;
diff --git a/src/utils/stationStorage.js b/src/utils/stationStorage.js
index 5ea458c16..4289c4018 100644
--- a/src/utils/stationStorage.js
+++ b/src/utils/stationStorage.js
@@ -17,7 +17,7 @@ export default function stationStorage() {
return getStations().filter((station) => station.name === stationName)[0].id;
};
- const getStationIdById = (stationId) => {
+ const getStationById = (stationId) => {
return getStations().filter((station) => station.id === stationId)[0];
};
@@ -25,6 +25,6 @@ export default function stationStorage() {
getStations,
setStation,
getStationIdByName,
- getStationIdById,
+ getStationById,
};
}
From 1649fa568b642dbeb0c8d57acd728884bdd7c1d2 Mon Sep 17 00:00:00 2001
From: devhyun637 <59258239+devhyun637@users.noreply.github.com>
Date: Tue, 15 Dec 2020 17:11:41 +0900
Subject: [PATCH 33/48] =?UTF-8?q?feat=20:=20=EB=85=B8=EC=84=A0=EC=97=90=20?=
=?UTF-8?q?=EC=97=AD=20=EC=B6=94=EA=B0=80=ED=95=98=EB=8A=94=20=EA=B8=B0?=
=?UTF-8?q?=EB=8A=A5=20=EC=83=9D=EC=84=B1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- μ€λ³΅λ μμ΄ μλμ§ μ ν¨μ± κ²μ¬ ꡬν
- μ
λ ₯νλ indexμ μ ν¨μ± κ²μ¬ ꡬν
---
src/components/oneSectionManager.js | 77 +++++++++++++++++++
src/components/sectionManagerPage.js | 22 +-----
.../template/sectionManagerTemplate.js | 16 ++--
src/utils/validator/sectionValidator.js | 30 ++++++++
4 files changed, 120 insertions(+), 25 deletions(-)
create mode 100644 src/components/oneSectionManager.js
create mode 100644 src/utils/validator/sectionValidator.js
diff --git a/src/components/oneSectionManager.js b/src/components/oneSectionManager.js
new file mode 100644
index 000000000..ccf0a7be7
--- /dev/null
+++ b/src/components/oneSectionManager.js
@@ -0,0 +1,77 @@
+import {
+ sectionIndexValidator,
+ sectionStationNameValidator,
+} from '../utils/validator/sectionValidator.js';
+import {
+ SECTION_MANAGER_PAGE_SELECTOR_TEMPLATE,
+ SECTION_MANAGER_PAGE_TABLE_TEMPLATE,
+ SECTION_TABLE_TEMPLATE,
+} from './template/sectionManagerTemplate.js';
+import { ALL_STATION_OPTION_LIST } from './template/lineManagerTemplate.js';
+import stationStorage from '../utils/stationStorage.js';
+import lineStorage from '../utils/lineStorage.js';
+
+export default function oneSectionManager($container, $table, line) {
+ const stations = stationStorage().getStations();
+ const lines = lineStorage().getLine();
+
+ $container.innerHTML = SECTION_MANAGER_PAGE_SELECTOR_TEMPLATE;
+ const $lineTitle = $container.querySelector('#line-title');
+ $lineTitle.innerText = `${line.name} κ΄λ¦¬`;
+
+ const $sectionSelector = $container.querySelector('#section-station-selector');
+ $sectionSelector.innerHTML = ALL_STATION_OPTION_LIST(stations);
+
+ $table.innerHTML = SECTION_MANAGER_PAGE_TABLE_TEMPLATE;
+ const $sectionTableBody = $table.querySelector('.section-table-tbody');
+ $sectionTableBody.innerHTML = SECTION_TABLE_TEMPLATE(line);
+
+ const $userSectionIndexInput = $container.querySelector('#section-order-input');
+ const $userSelectStationBtn = $container.querySelector('#section-station-selector');
+ const $userSectionSubmitBtn = $container.querySelector('#section-add-button');
+
+ const renderSection = (newLine) => {
+ $sectionTableBody.innerHTML = SECTION_TABLE_TEMPLATE(newLine);
+ };
+
+ const getStationById = (stationIds) => {
+ return stations.filter((station) => station.id === stationIds)[0];
+ };
+
+ const updateLineState = (stationId, stationIndex) => {
+ line.stationIds.splice(stationIndex, 0, stationId);
+ for (let i = 0; i < lines.length; i++) {
+ if (lines[i].id === line.id) {
+ lines[i] = line;
+ }
+ }
+ lineStorage().setLine(lines);
+ return line;
+ };
+
+ const updateStationState = (stationId) => {
+ getStationById(stationId).line.push(line.id);
+ stationStorage().setStation(stations);
+ };
+
+ const updateSection = (stationName, stationIndex) => {
+ const stationId = stationStorage().getStationIdByName(stationName);
+ updateStationState(stationIndex);
+ renderSection(updateLineState(stationId, stationIndex));
+ };
+
+ const onSectionSubmitHandler = () => {
+ const userSelectStationName = $userSelectStationBtn.value;
+ const userSectionIndex = parseInt($userSectionIndexInput.value);
+
+ if (
+ sectionStationNameValidator(line, stations, userSelectStationName) &&
+ sectionIndexValidator(line.stationIds.length, userSectionIndex)
+ ) {
+ updateSection(userSelectStationName, userSectionIndex);
+ }
+ $userSectionIndexInput.value = '';
+ };
+
+ $userSectionSubmitBtn.addEventListener('click', onSectionSubmitHandler);
+}
diff --git a/src/components/sectionManagerPage.js b/src/components/sectionManagerPage.js
index ab6f925d7..9f86347bc 100644
--- a/src/components/sectionManagerPage.js
+++ b/src/components/sectionManagerPage.js
@@ -1,41 +1,25 @@
import {
SECTION_MANAGER_PAGE_MENU_TEMPLATE,
- SECTION_MANAGER_PAGE_SELECTOR_TEMPLATE,
- SECTION_MANAGER_PAGE_TABLE_TEMPLATE,
SECTION_LINE_MENU_BTN,
- SECTION_TABLE_TEMPLATE,
} from './template/sectionManagerTemplate.js';
import lineStorage from '../utils/lineStorage.js';
-import stationStorage from '../utils/stationStorage.js';
-import { ALL_STATION_OPTION_LIST } from './template/lineManagerTemplate.js';
+import oneSectionManager from './oneSectionManager.js';
export default function sectionManagerPage($element) {
const lines = lineStorage().getLine();
- const stations = stationStorage().getStation();
$element.innerHTML = SECTION_MANAGER_PAGE_MENU_TEMPLATE;
const $listMenuBtn = $element.querySelector('.line-buttons');
$listMenuBtn.innerHTML = lines.map(SECTION_LINE_MENU_BTN).join('');
const $sectionSelectorContainer = $element.querySelector('#section-selector-container');
- const $lineTitle = $element.querySelector('#line-title');
-
- const renderSectionManager = (currentLine) => {
- $lineTitle.innerText = `${currentLine.name} κ΄λ¦¬`;
- $sectionSelectorContainer.innerHTML = SECTION_MANAGER_PAGE_SELECTOR_TEMPLATE;
- const $sectionSelector = $element.querySelector('#section-station-selector');
- const $sectionTable = $element.querySelector('#section-table');
- $sectionSelector.innerHTML = ALL_STATION_OPTION_LIST(stations);
- $sectionTable.innerHTML = SECTION_MANAGER_PAGE_TABLE_TEMPLATE;
- const $sectionTableBody = $element.querySelector('.section-table-tbody');
- $sectionTableBody.innerHTML = SECTION_TABLE_TEMPLATE(currentLine);
- };
+ const $sectionTable = $element.querySelector('#section-table');
const onMenuFilterHandler = (e) => {
if (!e.target.classList.contains('section-line-menu-button')) {
return;
}
const currentLine = lineStorage().getOneLine(e.target.dataset.lineid);
- renderSectionManager(currentLine);
+ oneSectionManager($sectionSelectorContainer, $sectionTable, currentLine);
};
$listMenuBtn.addEventListener('click', onMenuFilterHandler);
diff --git a/src/components/template/sectionManagerTemplate.js b/src/components/template/sectionManagerTemplate.js
index decf94dc9..e89c7fa39 100644
--- a/src/components/template/sectionManagerTemplate.js
+++ b/src/components/template/sectionManagerTemplate.js
@@ -1,15 +1,17 @@
+import stationStorage from '../../utils/stationStorage.js';
+
const SECTION_MANAGER_PAGE_MENU_TEMPLATE = `
`;
-const SECTION_MANAGER_PAGE_SELECTOR_TEMPLATE = `κ΅¬κ° λ±λ‘
-
-
- `;
+const SECTION_MANAGER_PAGE_SELECTOR_TEMPLATE = `
+ κ΅¬κ° λ±λ‘
+
+
+ `;
const SECTION_MANAGER_PAGE_TABLE_TEMPLATE = `
@@ -22,7 +24,9 @@ const SECTION_MANAGER_PAGE_TABLE_TEMPLATE = ``;
-const SECTION_TABLE_TEMPLATE = ({ id, stations }) => {
+const SECTION_TABLE_TEMPLATE = ({ id, stationIds }) => {
+ const stations = stationIds.map(stationStorage().getStationById);
+
return stations
.map(
(station, index) =>
diff --git a/src/utils/validator/sectionValidator.js b/src/utils/validator/sectionValidator.js
new file mode 100644
index 000000000..6560c4c33
--- /dev/null
+++ b/src/utils/validator/sectionValidator.js
@@ -0,0 +1,30 @@
+const isNotRegistered = (id, stations, stationName) => {
+ const stationLines = stations.filter((station) => station.name === stationName)[0].line;
+ return stationLines.includes(id) ? alert('μ΄λ―Έ λ±λ‘λ μμ
λλ€') : true;
+};
+
+const isNumber = (sectionIndex) => {
+ return Number.isNaN(sectionIndex) ? alert('μ νν μ«μλ₯Ό μ
λ ₯ν΄μ£ΌμΈμ') : true;
+};
+
+const isPositiveNumber = (sectionIndex) => {
+ return sectionIndex >= 0 ? true : alert('μμκ° μλ 0 μ΄μμ μ«μλ₯Ό μ
λ ₯ν΄μ£ΌμΈμ');
+};
+
+const isCorrectIndex = (sectionLength, sectionIndex) => {
+ return sectionIndex <= sectionLength ? true : alert('μ
λ ₯ν μμλ₯Ό νμΈν΄μ£ΌμΈμ');
+};
+
+function sectionStationNameValidator({ id }, stations, stationName) {
+ return isNotRegistered(id, stations, stationName);
+}
+
+function sectionIndexValidator(sectionLength, sectionIndex) {
+ return (
+ isNumber(sectionIndex) &&
+ isPositiveNumber(sectionIndex) &&
+ isCorrectIndex(sectionLength, sectionIndex)
+ );
+}
+
+export { sectionStationNameValidator, sectionIndexValidator };
From ac69f86949fec4054d7dc5580e81c01e18f896b4 Mon Sep 17 00:00:00 2001
From: devhyun637 <59258239+devhyun637@users.noreply.github.com>
Date: Tue, 15 Dec 2020 18:16:52 +0900
Subject: [PATCH 34/48] =?UTF-8?q?feat=20:=20=EB=85=B8=EC=84=A0=EC=97=90?=
=?UTF-8?q?=EC=84=9C=20=EC=97=AD=EC=9D=84=20=EC=82=AD=EC=A0=9C=ED=95=98?=
=?UTF-8?q?=EB=8A=94=20=EA=B8=B0=EB=8A=A5=20=EA=B5=AC=ED=98=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/oneSectionManager.js | 39 +++++++++++++++++++
.../template/sectionManagerTemplate.js | 2 +-
src/utils/validator/sectionValidator.js | 16 +++++++-
3 files changed, 55 insertions(+), 2 deletions(-)
diff --git a/src/components/oneSectionManager.js b/src/components/oneSectionManager.js
index ccf0a7be7..68e44cc84 100644
--- a/src/components/oneSectionManager.js
+++ b/src/components/oneSectionManager.js
@@ -1,6 +1,7 @@
import {
sectionIndexValidator,
sectionStationNameValidator,
+ sectionDeleteValidator,
} from '../utils/validator/sectionValidator.js';
import {
SECTION_MANAGER_PAGE_SELECTOR_TEMPLATE,
@@ -60,6 +61,43 @@ export default function oneSectionManager($container, $table, line) {
renderSection(updateLineState(stationId, stationIndex));
};
+ const removeStationInLine = (stationId) => {
+ const deleteIndex = line.stationIds.findIndex((id) => id === stationId);
+ line.stationIds.splice(deleteIndex, 1);
+ for (let i = 0; i < lines.length; i++) {
+ if (lines[i].id === line.id) {
+ lines[i] = line;
+ }
+ }
+ lineStorage().setLine(lines);
+ return line;
+ };
+
+ const removeLineInStation = (stationId, lineId) => {
+ const station = getStationById(stationId);
+ const deleteIndex = station.line.findIndex((lineNum) => lineNum === lineId);
+ station.line.splice(deleteIndex, 1);
+ stationStorage().setStation(stations);
+ };
+
+ const removeStationInSection = (stationId, lineId) => {
+ removeLineInStation(stationId, lineId);
+ console.log(lines);
+ renderSection(removeStationInLine(stationId));
+ };
+
+ const onRemoveSubmitHandler = (e) => {
+ const stationId = parseInt(e.target.dataset.stationid);
+ const lineId = parseInt(e.target.closest('tr').id); // line.id
+ if (Number.isNaN(stationId)) {
+ return;
+ }
+
+ if (sectionDeleteValidator(lineId) && confirm('μ λ§λ‘ λ
Έμ μμ μμ νμκ² μ΅λκΉ?')) {
+ removeStationInSection(stationId, lineId);
+ }
+ };
+
const onSectionSubmitHandler = () => {
const userSelectStationName = $userSelectStationBtn.value;
const userSectionIndex = parseInt($userSectionIndexInput.value);
@@ -74,4 +112,5 @@ export default function oneSectionManager($container, $table, line) {
};
$userSectionSubmitBtn.addEventListener('click', onSectionSubmitHandler);
+ $sectionTableBody.addEventListener('click', onRemoveSubmitHandler);
}
diff --git a/src/components/template/sectionManagerTemplate.js b/src/components/template/sectionManagerTemplate.js
index e89c7fa39..cf0a3304b 100644
--- a/src/components/template/sectionManagerTemplate.js
+++ b/src/components/template/sectionManagerTemplate.js
@@ -33,7 +33,7 @@ const SECTION_TABLE_TEMPLATE = ({ id, stationIds }) => {
`
| ${index} |
${station.name} |
- |
+ |
`
)
.join('');
diff --git a/src/utils/validator/sectionValidator.js b/src/utils/validator/sectionValidator.js
index 6560c4c33..49e5993c6 100644
--- a/src/utils/validator/sectionValidator.js
+++ b/src/utils/validator/sectionValidator.js
@@ -1,3 +1,5 @@
+import lineStorage from '../lineStorage.js';
+
const isNotRegistered = (id, stations, stationName) => {
const stationLines = stations.filter((station) => station.name === stationName)[0].line;
return stationLines.includes(id) ? alert('μ΄λ―Έ λ±λ‘λ μμ
λλ€') : true;
@@ -15,6 +17,14 @@ const isCorrectIndex = (sectionLength, sectionIndex) => {
return sectionIndex <= sectionLength ? true : alert('μ
λ ₯ν μμλ₯Ό νμΈν΄μ£ΌμΈμ');
};
+const isLengthLongerThanTwo = (lineId) => {
+ const stationLength = lineStorage().getOneLine(lineId).stationIds.length;
+ if (stationLength < 3) {
+ return alert('λ
Έμ μ μ΅μ 2κ°μ μμΌλ‘ μ΄λ£¨μ΄μ Έ μμ΅λλ€.');
+ }
+ return true;
+};
+
function sectionStationNameValidator({ id }, stations, stationName) {
return isNotRegistered(id, stations, stationName);
}
@@ -27,4 +37,8 @@ function sectionIndexValidator(sectionLength, sectionIndex) {
);
}
-export { sectionStationNameValidator, sectionIndexValidator };
+function sectionDeleteValidator(lineId) {
+ return isLengthLongerThanTwo(lineId);
+}
+
+export { sectionStationNameValidator, sectionIndexValidator, sectionDeleteValidator };
From 263b8c1c8aefa488e134d447b6124f7d60b610b4 Mon Sep 17 00:00:00 2001
From: devhyun637 <59258239+devhyun637@users.noreply.github.com>
Date: Tue, 15 Dec 2020 18:28:56 +0900
Subject: [PATCH 35/48] =?UTF-8?q?fix=20:=20=EB=85=B8=EC=84=A0=EC=97=90=20?=
=?UTF-8?q?=EB=93=B1=EB=A1=9D=ED=95=A0=20=EB=95=8C=20station=20=EC=83=81?=
=?UTF-8?q?=ED=83=9C=20=EC=98=A4=EB=A5=98=20=EC=88=98=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- μ ννμ§ μμ stationμ λ
Έμ λ²νΈκ° λ€μ΄κ°λ μ€λ₯ μμ
---
src/components/oneSectionManager.js | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/components/oneSectionManager.js b/src/components/oneSectionManager.js
index 68e44cc84..e0625fa23 100644
--- a/src/components/oneSectionManager.js
+++ b/src/components/oneSectionManager.js
@@ -57,7 +57,7 @@ export default function oneSectionManager($container, $table, line) {
const updateSection = (stationName, stationIndex) => {
const stationId = stationStorage().getStationIdByName(stationName);
- updateStationState(stationIndex);
+ updateStationState(stationId);
renderSection(updateLineState(stationId, stationIndex));
};
From 7ea4917e9f95f247594cb30405414f5a6e8bdc56 Mon Sep 17 00:00:00 2001
From: devhyun637 <59258239+devhyun637@users.noreply.github.com>
Date: Tue, 15 Dec 2020 19:04:29 +0900
Subject: [PATCH 36/48] =?UTF-8?q?feat=20:=20=EC=A0=84=EC=B2=B4=20=EC=A7=80?=
=?UTF-8?q?=ED=95=98=EC=B2=A0=20=EB=85=B8=EC=84=A0=EB=8F=84=20=EB=B3=B4?=
=?UTF-8?q?=EC=97=AC=EC=A3=BC=EB=8A=94=20=EA=B8=B0=EB=8A=A5=20=EA=B5=AC?=
=?UTF-8?q?=ED=98=84?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/components/mapPrintManagerPage.js | 5 ++++
.../template/mapPrintManagerTemplate.js | 24 +++++++++++++++++++
src/subwayMapApp.js | 3 ++-
3 files changed, 31 insertions(+), 1 deletion(-)
create mode 100644 src/components/mapPrintManagerPage.js
create mode 100644 src/components/template/mapPrintManagerTemplate.js
diff --git a/src/components/mapPrintManagerPage.js b/src/components/mapPrintManagerPage.js
new file mode 100644
index 000000000..d8ef19f85
--- /dev/null
+++ b/src/components/mapPrintManagerPage.js
@@ -0,0 +1,5 @@
+import MAP_MANAGER_PAGE_TEMPLATE from './template/mapPrintManagerTemplate.js';
+
+export default function mapPrintManagerPage($element) {
+ $element.innerHTML = MAP_MANAGER_PAGE_TEMPLATE();
+}
diff --git a/src/components/template/mapPrintManagerTemplate.js b/src/components/template/mapPrintManagerTemplate.js
new file mode 100644
index 000000000..fed0719d9
--- /dev/null
+++ b/src/components/template/mapPrintManagerTemplate.js
@@ -0,0 +1,24 @@
+import stationStorage from '../../utils/stationStorage.js';
+import lineStorage from '../../utils/lineStorage.js';
+
+const STATION_LIST_TEMPLATE = (stationId) => {
+ const station = stationStorage().getStationById(stationId);
+ return `${station.name}`;
+};
+
+const MAP_MANAGER_PAGE_TEMPLATE = () => {
+ const lines = lineStorage().getLine();
+ return `
+ ${lines
+ .map(
+ (line) =>
+ `
${line.name}
+ ${line.stationIds
+ .map(STATION_LIST_TEMPLATE)
+ .join('')}`
+ )
+ .join('')}
+
`;
+};
+
+export default MAP_MANAGER_PAGE_TEMPLATE;
diff --git a/src/subwayMapApp.js b/src/subwayMapApp.js
index e5d096bae..4205f9eec 100644
--- a/src/subwayMapApp.js
+++ b/src/subwayMapApp.js
@@ -1,6 +1,7 @@
import stationManagerPage from './components/stationManagerPage.js';
import lineManagerPage from './components/lineManagerPage.js';
import sectionManagerPage from './components/sectionManagerPage.js';
+import mapPrintManagerPage from './components/mapPrintManagerPage.js';
export default function subwayMapApp($element) {
const $stationManagerBtn = $element.querySelector('#station-manager-button');
@@ -19,7 +20,7 @@ export default function subwayMapApp($element) {
sectionManagerPage($contentSection);
};
const onMapPrintManageHandler = () => {
- console.log('μ 체 λ
Έμ λ μΆλ ₯ μ
λλ€.');
+ mapPrintManagerPage($contentSection);
};
$stationManagerBtn.addEventListener('click', onStationManageHandler);
From 7434a800c75a51335d63eaaf65baf28615279ef0 Mon Sep 17 00:00:00 2001
From: devhyun637 <59258239+devhyun637@users.noreply.github.com>
Date: Tue, 15 Dec 2020 19:04:45 +0900
Subject: [PATCH 37/48] =?UTF-8?q?style=20:=20css=20style=20=EC=B6=94?=
=?UTF-8?q?=EA=B0=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
index.html | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/index.html b/index.html
index 3012bea43..b0d5daab9 100644
--- a/index.html
+++ b/index.html
@@ -18,6 +18,10 @@
margin-left : 0.2rem;
}
+ li {
+ margin-left : 1rem;
+ }
+
.select-line-points {
margin: 1rem 0;
}
From 7db007572f6dfd00f534cc5f2f6207be845dc35e Mon Sep 17 00:00:00 2001
From: devhyun637 <59258239+devhyun637@users.noreply.github.com>
Date: Tue, 15 Dec 2020 21:56:23 +0900
Subject: [PATCH 38/48] =?UTF-8?q?refactor=20:=20init=20=ED=95=A8=EC=88=98?=
=?UTF-8?q?=20=EC=83=9D=EC=84=B1=20=EB=B0=8F=20=ED=99=94=EB=A9=B4=20?=
=?UTF-8?q?=EA=B5=AC=EC=84=B1=EC=9A=94=EC=86=8C=20views=20=ED=8F=B4?=
=?UTF-8?q?=EB=8D=94=EB=A1=9C=20=EC=9D=B4=EB=8F=99?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- μ μλ³μλ‘ μλ λ³μλ€μ init ν¨μμ λ£κΈ°
---
src/subwayMapApp.js | 39 +++++++++++++++------------------------
1 file changed, 15 insertions(+), 24 deletions(-)
diff --git a/src/subwayMapApp.js b/src/subwayMapApp.js
index 4205f9eec..31c00ff79 100644
--- a/src/subwayMapApp.js
+++ b/src/subwayMapApp.js
@@ -1,30 +1,21 @@
-import stationManagerPage from './components/stationManagerPage.js';
-import lineManagerPage from './components/lineManagerPage.js';
-import sectionManagerPage from './components/sectionManagerPage.js';
-import mapPrintManagerPage from './components/mapPrintManagerPage.js';
+import stationManagerPage from './components/views/stationManagerPage.js';
+import lineManagerPage from './components/views/lineManagerPage.js';
+import sectionManagerPage from './components/views/SectionManagerPages/sectionManagerPage.js';
+import mapPrintManagerPage from './components/views/mapPrintManagerPage.js';
export default function subwayMapApp($element) {
- const $stationManagerBtn = $element.querySelector('#station-manager-button');
- const $lineManagerBtn = $element.querySelector('#line-manager-button');
- const $sectionManagerBtn = $element.querySelector('#section-manager-button');
- const $mapPrintManagerBtn = $element.querySelector('#map-print-manager-button');
- const $contentSection = $element.querySelector('.content-container');
+ const init = () => {
+ const $stationManagerBtn = $element.querySelector('#station-manager-button');
+ const $lineManagerBtn = $element.querySelector('#line-manager-button');
+ const $sectionManagerBtn = $element.querySelector('#section-manager-button');
+ const $mapPrintManagerBtn = $element.querySelector('#map-print-manager-button');
+ const $contentSection = $element.querySelector('.content-container');
- const onStationManageHandler = () => {
- stationManagerPage($contentSection);
- };
- const onLineManageHandler = () => {
- lineManagerPage($contentSection);
- };
- const onSectionManageHandler = () => {
- sectionManagerPage($contentSection);
- };
- const onMapPrintManageHandler = () => {
- mapPrintManagerPage($contentSection);
+ $stationManagerBtn.addEventListener('click', () => stationManagerPage($contentSection));
+ $lineManagerBtn.addEventListener('click', () => lineManagerPage($contentSection));
+ $sectionManagerBtn.addEventListener('click', () => sectionManagerPage($contentSection));
+ $mapPrintManagerBtn.addEventListener('click', () => mapPrintManagerPage($contentSection));
};
- $stationManagerBtn.addEventListener('click', onStationManageHandler);
- $lineManagerBtn.addEventListener('click', onLineManageHandler);
- $sectionManagerBtn.addEventListener('click', onSectionManageHandler);
- $mapPrintManagerBtn.addEventListener('click', onMapPrintManageHandler);
+ init();
}
From 52b6f711858c5cdda399bba308c5be20bbcb10c1 Mon Sep 17 00:00:00 2001
From: devhyun637 <59258239+devhyun637@users.noreply.github.com>
Date: Tue, 15 Dec 2020 22:02:54 +0900
Subject: [PATCH 39/48] =?UTF-8?q?refactor=20:=20storage=20=ED=8F=B4?=
=?UTF-8?q?=EB=8D=94=20=EC=83=9D=EC=84=B1=20=EB=B0=8F=20=EA=B4=80=EB=A0=A8?=
=?UTF-8?q?=20=ED=8C=8C=EC=9D=BC=20=EC=9D=B4=EB=8F=99?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/{utils => storage}/lineStorage.js | 2 +-
src/{utils => storage}/stationStorage.js | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
rename src/{utils => storage}/lineStorage.js (93%)
rename src/{utils => storage}/stationStorage.js (92%)
diff --git a/src/utils/lineStorage.js b/src/storage/lineStorage.js
similarity index 93%
rename from src/utils/lineStorage.js
rename to src/storage/lineStorage.js
index 9b33232d5..fcc797a31 100644
--- a/src/utils/lineStorage.js
+++ b/src/storage/lineStorage.js
@@ -1,4 +1,4 @@
-import { LINE_STORAGE_NAME } from './constant.js';
+import { LINE_STORAGE_NAME } from '../utils/constant.js';
export default function lineStorage() {
const getLine = () => {
diff --git a/src/utils/stationStorage.js b/src/storage/stationStorage.js
similarity index 92%
rename from src/utils/stationStorage.js
rename to src/storage/stationStorage.js
index 4289c4018..e6b1b9891 100644
--- a/src/utils/stationStorage.js
+++ b/src/storage/stationStorage.js
@@ -1,4 +1,4 @@
-import { STATION_STORAGE_NAME } from './constant.js';
+import { STATION_STORAGE_NAME } from '../utils/constant.js';
export default function stationStorage() {
const getStations = () => {
From f02d06e387089077b04378f915f1402508842156 Mon Sep 17 00:00:00 2001
From: devhyun637 <59258239+devhyun637@users.noreply.github.com>
Date: Tue, 15 Dec 2020 22:03:25 +0900
Subject: [PATCH 40/48] =?UTF-8?q?refactor=20:=20=EC=97=AD=20=EA=B4=80?=
=?UTF-8?q?=EB=A6=AC=20=EA=B8=B0=EB=8A=A5=20=EC=BD=94=EB=93=9C=20=EB=A6=AC?=
=?UTF-8?q?=ED=8C=A9=ED=86=A0=EB=A7=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- temeplate μ½λ μ λ ¬
- μκ΄λ¦¬ νλ©΄ νμΌ(stationManagerPage) views ν΄λ μμ±νμ¬ μ΄λ
- stationManagerPage μ λ³μλͺ
μμ
- μ΅μ κΈμμ μμλ‘ μ μ₯
- μ μ΄λ¦ λ° μμ ν λ μ ν¨μ± κ²μ¬ μ½λ 리ν©ν λ§
---
.../template/stationManagerTemplate.js | 21 ++++---
.../{ => views}/stationManagerPage.js | 58 ++++++++++---------
src/utils/constant.js | 3 +-
src/utils/validator/stationValidator.js | 21 +++----
4 files changed, 51 insertions(+), 52 deletions(-)
rename src/components/{ => views}/stationManagerPage.js (71%)
diff --git a/src/components/template/stationManagerTemplate.js b/src/components/template/stationManagerTemplate.js
index b6fdc37f9..209f21d6b 100644
--- a/src/components/template/stationManagerTemplate.js
+++ b/src/components/template/stationManagerTemplate.js
@@ -2,17 +2,16 @@ const STATION_MANAGER_PAGE_TEMPLATE = `μ μ΄λ¦
-
- π μ§νμ² μ λͺ©λ‘
-
-
- | μ μ΄λ¦ |
- μ€μ |
-
-
-
-
-
+
+ π μ§νμ² μ λͺ©λ‘
+
+
+ | μ μ΄λ¦ |
+ μ€μ |
+
+
+
+
`;
const STATION_TABLE_TEMPLATE = (station) => {
diff --git a/src/components/stationManagerPage.js b/src/components/views/stationManagerPage.js
similarity index 71%
rename from src/components/stationManagerPage.js
rename to src/components/views/stationManagerPage.js
index c43e32225..17762faac 100644
--- a/src/components/stationManagerPage.js
+++ b/src/components/views/stationManagerPage.js
@@ -1,41 +1,24 @@
import {
STATION_MANAGER_PAGE_TEMPLATE,
STATION_TABLE_TEMPLATE,
-} from './template/stationManagerTemplate.js';
+} from '../template/stationManagerTemplate.js';
import {
stationNameValidator,
stationDeleteValidation,
-} from '../utils/validator/stationValidator.js';
-import stationStorage from '../utils/stationStorage.js';
-import Station from '../utils/Station.js';
+} from '../../utils/validator/stationValidator.js';
+import stationStorage from '../../storage/stationStorage.js';
+import Station from '../../utils/Station.js';
export default function stationManagerPage($element) {
$element.innerHTML = STATION_MANAGER_PAGE_TEMPLATE;
const $userStationInput = $element.querySelector('#station-name-input');
const $userStationSubmit = $element.querySelector('#station-add-button');
- const $stationTablebody = $element.querySelector('.station_manager_tbody');
+ const $stationTableBody = $element.querySelector('.station_manager_tbody');
let stations = stationStorage().getStations();
- const showStations = () => {
- $stationTablebody.innerHTML = stations.map(STATION_TABLE_TEMPLATE).join('');
- };
-
- const getNewId = () => {
- if (!stations || stations.length === 0) {
- return 0;
- }
- return stations[stations.length - 1].id + 1;
- };
-
- const addStations = (newStations) => {
- stations.push(newStations);
- stationStorage().setStation(stations);
- showStations();
- };
-
- const createStation = (newStationName) => {
- addStations(new Station(getNewId(), newStationName));
+ const renderStationTable = () => {
+ $stationTableBody.innerHTML = stations.map(STATION_TABLE_TEMPLATE).join('');
};
const deleteStation = (stationTag) => {
@@ -44,14 +27,33 @@ export default function stationManagerPage($element) {
}
stations = stations.filter((station) => station.id !== parseInt(stationTag.id));
stationStorage().setStation(stations);
- showStations();
+ renderStationTable();
};
const onStationDeleteHandler = (e) => {
if (!e.target.classList.contains('station-delete-button')) {
return false;
}
- deleteStation(e.target.closest('tr'));
+ if (confirm('μ λ§λ‘ μμ νμκ² μ΅λκΉ?')) {
+ deleteStation(e.target.closest('tr'));
+ }
+ };
+
+ const addStations = (newStations) => {
+ stations.push(newStations);
+ stationStorage().setStation(stations);
+ renderStationTable();
+ };
+
+ const getNewId = () => {
+ if (!stations || stations.length === 0) {
+ return 0;
+ }
+ return stations[stations.length - 1].id + 1;
+ };
+
+ const createStation = (newStationName) => {
+ addStations(new Station(getNewId(), newStationName));
};
const onStationSubmitHandler = () => {
@@ -63,6 +65,6 @@ export default function stationManagerPage($element) {
};
$userStationSubmit.addEventListener('click', onStationSubmitHandler);
- $stationTablebody.addEventListener('click', onStationDeleteHandler);
- showStations();
+ $stationTableBody.addEventListener('click', onStationDeleteHandler);
+ renderStationTable();
}
diff --git a/src/utils/constant.js b/src/utils/constant.js
index 38363dfcb..2dd21c072 100644
--- a/src/utils/constant.js
+++ b/src/utils/constant.js
@@ -1,4 +1,5 @@
const STATION_STORAGE_NAME = 'STATIONS';
const LINE_STORAGE_NAME = 'LINES';
+const NAME_MINT_LENGTH = 2;
-export { STATION_STORAGE_NAME, LINE_STORAGE_NAME };
+export { STATION_STORAGE_NAME, LINE_STORAGE_NAME, NAME_MINT_LENGTH };
diff --git a/src/utils/validator/stationValidator.js b/src/utils/validator/stationValidator.js
index 7d382d49d..cd50c3771 100644
--- a/src/utils/validator/stationValidator.js
+++ b/src/utils/validator/stationValidator.js
@@ -1,22 +1,19 @@
+import { NAME_MINT_LENGTH } from '../constant.js';
+
const isNameLengthLongerThanTwo = (stationName) => {
- if (stationName.length < 2) {
- return alert('μ΄λ¦μ λκΈμ μ΄μμ
λλ€');
- }
- return true;
+ return stationName.length < NAME_MINT_LENGTH ? alert('μ΄λ¦μ λκΈμ μ΄μμ
λλ€') : true;
};
const isEqualName = (stations, stationName) => {
- if (stations && stations.map((value) => value.name).includes(stationName)) {
- return alert('μ€λ³΅λ μ΄λ¦μ
λλ€.');
- }
- return true;
+ return stations && stations.map((value) => value.name).includes(stationName)
+ ? alert('μ€λ³΅λ μ΄λ¦μ
λλ€.')
+ : true;
};
const isIncludedLine = (stationTag) => {
- if (stationTag.dataset.lines.length !== 0) {
- return alert('λ
Έμ μ ν¬ν¨λμ΄ μλ λΌμΈμ μμ ν μ μμ΅λλ€');
- }
- return true;
+ return stationTag.dataset.lines.length !== 0
+ ? alert('λ
Έμ μ ν¬ν¨λμ΄ μλ λΌμΈμ μμ ν μ μμ΅λλ€')
+ : true;
};
function stationNameValidator(stations, stationName) {
From 07227100081511088a3c82f6e4d9f10657bcdb00 Mon Sep 17 00:00:00 2001
From: devhyun637 <59258239+devhyun637@users.noreply.github.com>
Date: Tue, 15 Dec 2020 22:32:18 +0900
Subject: [PATCH 41/48] =?UTF-8?q?refactor=20:=20=EB=B3=80=EC=88=98?=
=?UTF-8?q?=EB=AA=85=20=EB=B3=B5=EC=88=98=ED=98=95=EC=9C=BC=EB=A1=9C=20?=
=?UTF-8?q?=EC=88=98=EC=A0=95?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/storage/lineStorage.js | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/storage/lineStorage.js b/src/storage/lineStorage.js
index fcc797a31..4d9fcdbec 100644
--- a/src/storage/lineStorage.js
+++ b/src/storage/lineStorage.js
@@ -1,7 +1,7 @@
import { LINE_STORAGE_NAME } from '../utils/constant.js';
export default function lineStorage() {
- const getLine = () => {
+ const getLines = () => {
if (!localStorage.getItem(LINE_STORAGE_NAME)) {
return [];
}
@@ -14,19 +14,19 @@ export default function lineStorage() {
};
const getStartPointsId = () => {
- return getLine().map((line) => line.stationIds[0]);
+ return getLines().map((line) => line.stationIds[0]);
};
const getEndPointsId = () => {
- return getLine().map((line) => line.stationIds[line.stationIds.length - 1]);
+ return getLines().map((line) => line.stationIds[line.stationIds.length - 1]);
};
const getOneLine = (lineId) => {
- return getLine().filter((line) => line.id === parseInt(lineId))[0];
+ return getLines().filter((line) => line.id === parseInt(lineId))[0];
};
return {
- getLine,
+ getLines,
setLine,
getStartPointsId,
getEndPointsId,
From a555f28319296107d0a8b4197324011d7a5bd2dc Mon Sep 17 00:00:00 2001
From: devhyun637 <59258239+devhyun637@users.noreply.github.com>
Date: Tue, 15 Dec 2020 22:34:17 +0900
Subject: [PATCH 42/48] =?UTF-8?q?refactor=20:=20=EB=85=B8=EC=84=A0=20?=
=?UTF-8?q?=EA=B4=80=EB=A6=AC=20=EA=B8=B0=EB=8A=A5=20=EC=BD=94=EB=93=9C=20?=
=?UTF-8?q?=EB=A6=AC=ED=8C=A9=ED=86=A0=EB=A7=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- views ν΄λλ‘ lineManagerPage νμΌ μ΄λ
- λ©μλ μμ μμ
---
.../template/lineManagerTemplate.js | 2 +-
src/components/{ => views}/lineManagerPage.js | 77 +++++++++----------
2 files changed, 38 insertions(+), 41 deletions(-)
rename src/components/{ => views}/lineManagerPage.js (74%)
diff --git a/src/components/template/lineManagerTemplate.js b/src/components/template/lineManagerTemplate.js
index 1255fc9c0..815ac02d3 100644
--- a/src/components/template/lineManagerTemplate.js
+++ b/src/components/template/lineManagerTemplate.js
@@ -1,4 +1,4 @@
-import stationStorage from '../../utils/stationStorage.js';
+import stationStorage from '../../storage/stationStorage.js';
const LINE_MANAGER_PAGE_TEMPLATE = `
λ
Έμ μ΄λ¦
diff --git a/src/components/lineManagerPage.js b/src/components/views/lineManagerPage.js
similarity index 74%
rename from src/components/lineManagerPage.js
rename to src/components/views/lineManagerPage.js
index db33ab3f7..6eea2a0fb 100644
--- a/src/components/lineManagerPage.js
+++ b/src/components/views/lineManagerPage.js
@@ -2,11 +2,11 @@ import {
LINE_MANAGER_PAGE_TEMPLATE,
ALL_STATION_OPTION_LIST,
LINE_TABLE_TEMPLATE,
-} from './template/lineManagerTemplate.js';
-import { lineNameValidator, lineStationsValidator } from '../utils/validator/lineValidator.js';
-import stationStorage from '../utils/stationStorage.js';
-import lineStorage from '../utils/lineStorage.js';
-import Line from '../utils/Line.js';
+} from '../template/lineManagerTemplate.js';
+import { lineNameValidator, lineStationsValidator } from '../../utils/validator/lineValidator.js';
+import stationStorage from '../../storage/stationStorage.js';
+import lineStorage from '../../storage/lineStorage.js';
+import Line from '../../utils/Line.js';
export default function stationManagerPage($element) {
$element.innerHTML = LINE_MANAGER_PAGE_TEMPLATE;
@@ -17,7 +17,7 @@ export default function stationManagerPage($element) {
const $lineTableBody = $element.querySelector('.line-table-tbody');
const stations = stationStorage().getStations();
- let lines = lineStorage().getLine();
+ let lines = lineStorage().getLines();
$startStation.innerHTML = ALL_STATION_OPTION_LIST(stations);
$endStation.innerHTML = ALL_STATION_OPTION_LIST(stations);
@@ -33,42 +33,15 @@ export default function stationManagerPage($element) {
return lines[lines.length - 1].id + 1;
};
- const addLine = (newLine) => {
- lines.push(newLine);
- lineStorage().setLine(lines);
- renderLines();
- };
-
- const getStation = (stationName) => {
- return stations.filter((station) => station.name === stationName)[0];
- };
-
const getStationById = (stationIds) => {
return stations.filter((station) => station.id === stationIds)[0];
};
- const addLineInStation = (lineId, stationName) => {
- getStation(stationName).line.push(lineId);
- stationStorage().setStation(stations);
- };
-
- const createLine = (newLineName, startStationName, endStationName) => {
- const startStationId = stationStorage().getStationIdByName(startStationName);
- const endStationId = stationStorage().getStationIdByName(endStationName);
- const newLine = new Line(getNewId(), newLineName);
- newLine.setLine(startStationId, 0);
- newLine.setLine(endStationId, 1);
-
- addLineInStation(newLine.id, startStationName);
- addLineInStation(newLine.id, endStationName);
- addLine(newLine);
- };
-
const removeLineInStation = (currentLineId) => {
- const stationIdsInLine = lines.filter((line) => line.id === parseInt(currentLineId))[0]
- .stationIds;
+ const stationsInLine = lines
+ .filter((line) => line.id === parseInt(currentLineId))[0]
+ .stationIds.map(getStationById);
- const stationsInLine = stationIdsInLine.map(getStationById);
for (let i = 0; i < stationsInLine.length; i++) {
const deleteIndex = stationsInLine[i].line.indexOf(parseInt(currentLineId));
stationsInLine[i].line.splice(deleteIndex, 1);
@@ -92,17 +65,41 @@ export default function stationManagerPage($element) {
}
};
+ const addLine = (newLine) => {
+ lines.push(newLine);
+ lineStorage().setLine(lines);
+ renderLines();
+ };
+
+ const getStation = (stationName) => {
+ return stations.filter((station) => station.name === stationName)[0];
+ };
+
+ const addLineInStation = (lineId, stationName) => {
+ getStation(stationName).line.push(lineId);
+ stationStorage().setStation(stations);
+ };
+
+ const createLine = (newLineName, startStationName, endStationName) => {
+ const newLine = new Line(getNewId(), newLineName);
+ newLine.setLine(stationStorage().getStationIdByName(startStationName), 0);
+ newLine.setLine(stationStorage().getStationIdByName(endStationName), 1);
+
+ addLineInStation(newLine.id, startStationName);
+ addLineInStation(newLine.id, endStationName);
+ addLine(newLine);
+ };
+
const onLineSubmitHandler = () => {
const newLineName = $userInputLine.value;
- const startStationName = $startStation.value;
- const endStationName = $endStation.value;
if (
lineNameValidator(lines, newLineName) &&
- lineStationsValidator(startStationName, endStationName)
+ lineStationsValidator($startStation.value, $endStation.value)
) {
- createLine(newLineName, startStationName, endStationName);
+ createLine(newLineName, $startStation.value, $endStation.value);
}
+
$userInputLine.value = '';
};
From 0b0cb07aab4c4c14b5702724b7017d99f5025881 Mon Sep 17 00:00:00 2001
From: devhyun637 <59258239+devhyun637@users.noreply.github.com>
Date: Tue, 15 Dec 2020 22:35:13 +0900
Subject: [PATCH 43/48] =?UTF-8?q?refactor=20:=20=EB=85=B8=EC=84=A0=20?=
=?UTF-8?q?=EC=9C=A0=ED=9A=A8=EC=84=B1=20=EA=B2=80=EC=82=AC=20=EC=BD=94?=
=?UTF-8?q?=EB=93=9C=20=EB=A6=AC=ED=8C=A9=ED=86=A0=EB=A7=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- ν¨μ μν λΆλ¦¬
- λΆνμν λ³μ μμ
---
src/utils/validator/lineValidator.js | 36 +++++++++++++---------------
1 file changed, 17 insertions(+), 19 deletions(-)
diff --git a/src/utils/validator/lineValidator.js b/src/utils/validator/lineValidator.js
index d93acb6fc..a4cec836e 100644
--- a/src/utils/validator/lineValidator.js
+++ b/src/utils/validator/lineValidator.js
@@ -1,5 +1,5 @@
-import lineStorage from '../lineStorage.js';
-import stationStorage from '../stationStorage.js';
+import lineStorage from '../../storage/lineStorage.js';
+import stationStorage from '../../storage/stationStorage.js';
const isEqualName = (lines, lineName) => {
return lines.some((line) => line.name === lineName) ? alert('μ€λ³΅λ λ
Έμ μ΄λ¦μ
λλ€.') : true;
@@ -21,31 +21,29 @@ const isEqualPoints = (startStationName, endStationName) => {
: true;
};
-const isEqualLine = (startStationName, endStationName) => {
- const startStationId = stationStorage().getStationIdByName(startStationName);
- const endStationId = stationStorage().getStationIdByName(endStationName);
-
- const startStationIds = lineStorage()
+const getStartStationIds = (stationName) => {
+ return lineStorage()
.getStartPointsId()
- .map((stationId) => stationId === parseInt(startStationId));
- const endStationIds = lineStorage()
+ .map((stationId) => stationId === parseInt(stationStorage().getStationIdByName(stationName)));
+};
+
+const getEndStationIds = (stationName) => {
+ return lineStorage()
.getEndPointsId()
- .map((stationId) => stationId === parseInt(endStationId));
+ .map((stationId) => stationId === parseInt(stationStorage().getStationIdByName(stationName)));
+};
+
+const isEqualLine = (startStationName, endStationName) => {
+ const startStationIds = getStartStationIds(startStationName);
+ const endStationIds = getEndStationIds(endStationName);
const equalLine = startStationIds.filter((station, index) => station && endStationIds[index]);
return equalLine.length !== 0 ? alert('λμΌν μ’
μ μ κ°μ§ λ
Έμ μ΄ μμ΅λλ€') : true;
};
const isEqualReverseLine = (startStationName, endStationName) => {
- const startStationId = stationStorage().getStationIdByName(startStationName);
- const endStationId = stationStorage().getStationIdByName(endStationName);
-
- const endStationsIds = lineStorage()
- .getStartPointsId()
- .map((stationId) => stationId === parseInt(startStationId));
- const StartStationsIds = lineStorage()
- .getEndPointsId()
- .map((stationId) => stationId === parseInt(endStationId));
+ const endStationsIds = getStartStationIds(startStationName);
+ const StartStationsIds = getEndStationIds(endStationName);
const equalLine = StartStationsIds.filter((station, index) => station && endStationsIds[index]);
return equalLine.length !== 0 ? alert('λμΌν μ’
μ μ κ°μ§ λ
Έμ μ΄ μμ΅λλ€') : true;
From ff349819d7ee0c71837fc8789183b7761d805c3d Mon Sep 17 00:00:00 2001
From: devhyun637 <59258239+devhyun637@users.noreply.github.com>
Date: Tue, 15 Dec 2020 22:53:03 +0900
Subject: [PATCH 44/48] =?UTF-8?q?refactor=20:=20=EC=98=A4=ED=83=80=20?=
=?UTF-8?q?=EC=88=98=EC=A0=95=20=EB=B0=8F=20=20section=20=EC=B5=9C?=
=?UTF-8?q?=EC=86=8C=20=EA=B0=9C=EC=88=98=20=EC=B6=94=EA=B0=80?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
src/utils/constant.js | 5 +++--
src/utils/validator/stationValidator.js | 4 ++--
2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/src/utils/constant.js b/src/utils/constant.js
index 2dd21c072..98c0788fe 100644
--- a/src/utils/constant.js
+++ b/src/utils/constant.js
@@ -1,5 +1,6 @@
const STATION_STORAGE_NAME = 'STATIONS';
const LINE_STORAGE_NAME = 'LINES';
-const NAME_MINT_LENGTH = 2;
+const NAME_MIN_LENGTH = 2;
+const SECTION_MIN_LENGTH = 2;
-export { STATION_STORAGE_NAME, LINE_STORAGE_NAME, NAME_MINT_LENGTH };
+export { STATION_STORAGE_NAME, LINE_STORAGE_NAME, NAME_MIN_LENGTH, SECTION_MIN_LENGTH };
diff --git a/src/utils/validator/stationValidator.js b/src/utils/validator/stationValidator.js
index cd50c3771..12f8763b8 100644
--- a/src/utils/validator/stationValidator.js
+++ b/src/utils/validator/stationValidator.js
@@ -1,7 +1,7 @@
-import { NAME_MINT_LENGTH } from '../constant.js';
+import { NAME_MIN_LENGTH } from '../constant.js';
const isNameLengthLongerThanTwo = (stationName) => {
- return stationName.length < NAME_MINT_LENGTH ? alert('μ΄λ¦μ λκΈμ μ΄μμ
λλ€') : true;
+ return stationName.length < NAME_MIN_LENGTH ? alert('μ΄λ¦μ λκΈμ μ΄μμ
λλ€') : true;
};
const isEqualName = (stations, stationName) => {
From 20456c213e68d1f5893fcbb5bdb5ede213a30bd0 Mon Sep 17 00:00:00 2001
From: devhyun637 <59258239+devhyun637@users.noreply.github.com>
Date: Tue, 15 Dec 2020 22:56:01 +0900
Subject: [PATCH 45/48] =?UTF-8?q?refactor=20:=20=EB=85=B8=EC=84=A0=20?=
=?UTF-8?q?=EB=93=B1=EB=A1=9D=20=EA=B8=B0=EB=8A=A5=20=EC=BD=94=EB=93=9C=20?=
=?UTF-8?q?=EB=A6=AC=ED=8C=A9=ED=86=A0=EB=A7=81?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- views ν΄λλ‘ SectionManager νμΌ μ΄λ
- λΆνμν λ³μ μμ λ° λΉ λ₯Έ return
- λ©μλ μμ λ³κ²½
---
.../template/sectionManagerTemplate.js | 10 ++--
.../sectionManagerPage.js | 10 ++--
.../singleSectionManager.js} | 59 +++++++++----------
src/utils/validator/sectionValidator.js | 21 +++----
4 files changed, 50 insertions(+), 50 deletions(-)
rename src/components/{ => views/SectionManagerPages}/sectionManagerPage.js (71%)
rename src/components/{oneSectionManager.js => views/SectionManagerPages/singleSectionManager.js} (89%)
diff --git a/src/components/template/sectionManagerTemplate.js b/src/components/template/sectionManagerTemplate.js
index cf0a3304b..7a5123daf 100644
--- a/src/components/template/sectionManagerTemplate.js
+++ b/src/components/template/sectionManagerTemplate.js
@@ -1,4 +1,4 @@
-import stationStorage from '../../utils/stationStorage.js';
+import stationStorage from '../../storage/stationStorage.js';
const SECTION_MANAGER_PAGE_MENU_TEMPLATE = `