From d5b11acdfdb13b66040ddc41b9ae653e3fd7a76d Mon Sep 17 00:00:00 2001 From: jcw780 <30562395+jcw780@users.noreply.github.com> Date: Sat, 6 Feb 2021 14:54:50 -0500 Subject: [PATCH 1/9] feature: ship upgrades basic UI complete --- public/upgrades/icon_module_Artillery.png | Bin 0 -> 1229 bytes .../icon_module_Artillery_installed.png | Bin 0 -> 1668 bytes public/upgrades/icon_module_Engine.png | Bin 0 -> 1777 bytes .../upgrades/icon_module_Engine_installed.png | Bin 0 -> 2365 bytes public/upgrades/icon_module_Hull.png | Bin 0 -> 1768 bytes .../upgrades/icon_module_Hull_installed.png | Bin 0 -> 2040 bytes public/upgrades/icon_module_Suo.png | Bin 0 -> 1173 bytes public/upgrades/icon_module_Suo_installed.png | Bin 0 -> 1249 bytes public/upgrades/icon_module_Torpedoes.png | Bin 0 -> 975 bytes .../icon_module_Torpedoes_installed.png | Bin 0 -> 1494 bytes src/components/ShellForms/DefaultForms.tsx | 203 +++++++++++++++++- 11 files changed, 198 insertions(+), 5 deletions(-) create mode 100644 public/upgrades/icon_module_Artillery.png create mode 100644 public/upgrades/icon_module_Artillery_installed.png create mode 100644 public/upgrades/icon_module_Engine.png create mode 100644 public/upgrades/icon_module_Engine_installed.png create mode 100644 public/upgrades/icon_module_Hull.png create mode 100644 public/upgrades/icon_module_Hull_installed.png create mode 100644 public/upgrades/icon_module_Suo.png create mode 100644 public/upgrades/icon_module_Suo_installed.png create mode 100644 public/upgrades/icon_module_Torpedoes.png create mode 100644 public/upgrades/icon_module_Torpedoes_installed.png diff --git a/public/upgrades/icon_module_Artillery.png b/public/upgrades/icon_module_Artillery.png new file mode 100644 index 0000000000000000000000000000000000000000..a5c0060830375f9a9fd1d63547787c05f61b5645 GIT binary patch literal 1229 zcmV;;1Ty=HP)m}lb9xIYGRv% zN)Hi1L?{ZPc=6Ih3*yy-Rn$Y#*r1o3xE=KtBatJSJ&Kgl82K9hY1?A2S* z?RMKqZx5s+s1~Fmq(8LEa>JRh3cdRgdiNBR`HV0+1-Krp53jWvz-hp`V6hw%)^#$lZdm*t>p@w_slaAn zo2C042h0lVk$M`-e0B%s0b9GD*tDI2xxteA?F`HvmfUYwU?H$}oV1!yxv8nCZV|AJ z1V+V*_#ZyoJytc5&$JE*41g#w(*DmgO!6| z*~-dFKlu)GqA;lwi9}B8v1zlgyn$6=iA+yVcN1GAf_2Bo$8W5!ufK(%`%|w?Q`TwA zfT^&ghn2mmtYgHcvGI(;8Uj`ea~gq__o^CPGMVgTuxY-)lsJ(gSQ<2=P4fd*#))Lm zreNzq8?}alwyIU zLE|;Zm94Fv$K=;dcC1= zIDCh9U<;oOzvT}GgKcC90tGk0hfc!B60hHJtL>8k*aK_dS!H=V9>3P!-u{j^ENnW4 zFvl}rY*_q^jhf5lK11FMmpRrRrk)RLElspdgIU4nsm;`wFmfV=i(Eo&Sm|twf>whi z0-KyithQ@((h>?ygO%;yU6uihgw_e`vm96iwAHYtA|AY;8v)A_;$ebr6fA2@%M>)0 zlOUYcusnizhM;M|JS$*%MJ;tf(}HlGur18YJfaJ`AlDrgahX}h2iSkLUu5`HxU%fr literal 0 HcmV?d00001 diff --git a/public/upgrades/icon_module_Artillery_installed.png b/public/upgrades/icon_module_Artillery_installed.png new file mode 100644 index 0000000000000000000000000000000000000000..ed33d14a9e01259ac14f2867795bb576046ad143 GIT binary patch literal 1668 zcmV-~27CF5P)DLM>;1*IcRF|igk z0!ou~$nyg7zPIle&#!)*-E;3b=bppmg1_yzd+zT%?(cKH-|z4HIOi&iMx(<*YD$L% z))pMFn(u)Mg<>wvTLs+>rv?2X^a*nZ(`L&X*w~b1Q$ody$7on>S6$kBYL!CgA6NGF z$k=4(d{ycHV0}EDUzzVVJOj2*KUTs>w@Vfqwy`>!gGKvwba7Jq;<412eFF1^?X21T zJ|6G2@ryk87_du~76R+3b4s0@GU{=CwM!co3j3gM^r-LVlkdRzu-)0P6|h6lr_A|j zzq|-31KkKg7 z*G?ux%MClLz>Lb`0%8D=Vfc>PrT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+pG z*ueO*yYM%{s}3q_&>3P1+Dya8&CSh=b8~a2c&#m>sy!aGhXnNHKs1%Gwv z^~}u7Y8vGk9*votoIDGg;`Z2Pu~^1AS?3uFKpN?CQ;aShL6q+$4nEjKZtez8CwzDr zu916<>>qj`ag;PT;}}tPmrM)p8$}hp;!V^;&=0o5jFga_0}YrM44e-E z!itNI^`8jwYOKr7&d%p3v@1n8NrCrgh=w55uqoz`m>!XqmUbJCA>u@yr-3z_&EFLl z7vJk?8t(^KvES~34~I*g2S?%4QJC{^sF-aFaBVe#IzqAXiRkF)qXZttZ%VJ%x8>#K zO)_#}-4F03csKx-GAWs{Q?U-TGveaYSr5Me|KC#JM0@~n0B`_s0I;0XKLQK@fV{X6 T8j*zq00000NkvXXu0mjfS@Tsd literal 0 HcmV?d00001 diff --git a/public/upgrades/icon_module_Engine_installed.png b/public/upgrades/icon_module_Engine_installed.png new file mode 100644 index 0000000000000000000000000000000000000000..38f508257a077cf039a3b3db79339a7af1f35988 GIT binary patch literal 2365 zcmV-D3BvY?P)R~Ak}7DxaAQNe00 zw1Y_L0TiuEaRIBI7(>+ z1S+5c0%emBmO%D(?j3$w4--O`mpPd!@0|aH_mls<_q}`Hz2E)v)Af2i?f29ewBK19 z0XzbD1n~cMV-EKPI-O2p9yVMYxLDMj4mdRRKTH!kxU_Jo;Znh+r0!YO3}v8U0qcun zEt-rTDnLLy4_A&`=10$m1o*nmcj2;w*(`<+(}Cdy`{>laD4Is6*LSHkx(1m-Q`IJt z6{clY-bl-=YJ-2vs0|?2=)>mWk`0!CbzU-i;r!|ma?yg&@!8gb?T;Tc_7me>_BLKv`z~}{?J7zGSjO9{0w+EjIQDZ`D3jzyKJMkb z^VFV*5Gv@|OGOqI6W_o&>2#KJr`^N76_9x^>}$E#jWiFFccZeIsBaKDz&bHG~kvF z>AufS-)SaML6NS9r3Iy}?~_>AuLH_8`9Z6*4#S^B0wPhsU}f2&jo;mD5lTNKF&;$a z!WG+cH+1zXMdlU`|4qfCcf!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{+lYhu$&wT$U+@f81>_}TEosfOF z_OuA4hpq6Q_K%L2ZKav;Q;bP~QH2ESbgbBx8wbVpRWl>=-6TQrJMf$_sw!Q!)2GTXk@5VHkY2oU-&Ym&_`H#^ z^>Fq?r!UvVLK^Hc1FWXJrZX<$%?kxI6Mu>^`#miv+>!h8Zhsve`LwTlf+0~47Twv@ zE_1tNoFpizGiF(vyom=39C&ebKrjCH%c1519W*9ZalEA1X+Ezm{lh|cSB@W8 zR1d_ZA*Y}*@7+%dYbkP}8YZop517!~v=%EwwBJPd0r6ciz{Q6@yp5y1A`{w2TwzOz*jfw3F-00000NkvXXu0mjf3ha%Z literal 0 HcmV?d00001 diff --git a/public/upgrades/icon_module_Hull.png b/public/upgrades/icon_module_Hull.png new file mode 100644 index 0000000000000000000000000000000000000000..e10a429051ebc06a4cd872b117f2fa8510ceaa90 GIT binary patch literal 1768 zcmVP);c^OBRhW5*@}r&O|Y~Ob8MFIHDNw2a#ypqKShcs9Ay-;yl&w0*!&S_(U!JuwCg;?D- z3){|M!+INtiHXrt%z|iIql^b}j<kVIVrSu&~hU_xt~%NY9kFWf5*|ZGFDKzrR_p*JmK!PtTOMWf6`Bm5y1j zYZ=KpJT*0SoYEsljkEcb92ei(9k^NW(ob zX=HGn0c}h|>D$kpJNI0;{qenaEfv){oI;0jJ~XLywC$EGgt%5zA#Ptw8;R)LElG%~ ztxKlb+S+1XDpQ>>yC&)@{+<|2#&&miKV4p4{t!!FLUwR)@R;B4AK^8a>QG&Ud8;og zE8BJc{P`E;MsGC2iNnLgZ??6yJ&xy8EeCd519PaC+S1ZeGCDf?HcNToq6Lv68m~x$ zqR-}uiHZ8;~_1q zUtC-q-??+=39r{XDWi8BkwTbgu{4(Q?hq!2!||mOY8dQ*Qa+67XY-)ypU6K`A2OQX zMsJ~%W@wzCL|-+7>8g~{Q>RWnCQq?L`gbjZWi(G<=`DO64$*jWa`KOol9HcTmy)IQ z*x1-Rp#1LTU&T6&3o}ZupBy;99g%^{Vo15E!Hm3<( z+0@i@v}@34tR-}&d|PFMAvGf-qe9^@&c>9>4xK||o&7~Ejf;!B)kj`l-htHA)CwgZ zy`rKbNjl|}kCCoj=eR{nIt7tOJ?}EZ&OfkVPNV-kww4a41!+FVvEyg$GiX7wsi~=k zSw>DbG&HoRU7g%|F3JVK=^LRW~Ao5D6KE5+U?DkPiNlDScA^8Thd>D1J&>r;{ zfNFoH*Xt88x0CVRUa)|!Rb$cjQ6=P6ei7setJ0*#XgvGm$&zBh`lbE*_kXLg_zGU;-*^%KfcEzxnh=e6IRzMR zf{fNpSUGN7xNzY{O-;>p68<~XTWPyT0zeuP6c~u=0-IlEsjT{=7Rm%YSAm>^*CC;G zR7!u4e^v^hvMJp0kW$KVw(XP-5VZNyG{xvvPb9){4c`^jHpYI9Y~cCXQUGtsrV|)2 z=gp$p#@Ov@m+EQ;uRG}D2hhT$+Av`xX$1hsrJbrJlGh$AdZ`&SXcqjngu?z^SU7XJUE)>aSy2`~Tx$3ScgoUoDr0000< KMNUMnLSTY(jcAqt literal 0 HcmV?d00001 diff --git a/public/upgrades/icon_module_Hull_installed.png b/public/upgrades/icon_module_Hull_installed.png new file mode 100644 index 0000000000000000000000000000000000000000..02da2468d4da4c7248c3e776ff532f61ac473528 GIT binary patch literal 2040 zcmV;tjCaB#)*B9!N0RwiOU+()rGRwuw=cY#OT0g1Y&wVj4SND*j zbm8X8RElyLcOSl%{pHbyTriFi^*vOS7E*Q;=bixqcFvp}zZj8&a=AKD-;fop6uil~J1Hi@phlq2 zsBg$xxM=>^-OPcIMI*-455aCkfSUAu0DqD)16$n2DS6oohmtdQD@QU@0S`D;R1j6F3cY&#^|M+3L_S{r;izVJ|+dto~}woC#@R z70mv+2K{T}U;cJKfb8kl`h&=adx1hjLY1eF8n%Z0_tZq~YK2^K67ECyPyigOT4S{^ zQtIo67QC)fNTT>mWwlZIg#52d1wAzlG7GDcVl~?Yj`;$YLSwP8xA@CWIM{`ifQSUe z<3V6y-tm_%XUg+ebG;N8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 diff --git a/public/upgrades/icon_module_Suo_installed.png b/public/upgrades/icon_module_Suo_installed.png new file mode 100644 index 0000000000000000000000000000000000000000..7bfb482b99e4dbd7a16bae879c5053d4903d422c GIT binary patch literal 1249 zcmV<71Rnc|P)tHuq){~r^?mw6IJKs6~<+LMsp3lmpL}q1J(gEv$b->zA zhC~M-2tuja4%sS`c_6!D3@i5YNXoE2@md!{3MMfOB>(nsf7k@AzEUb&T9pRDe%Mwl z1(_>hf)cgE5g0BJLH-=_w#_TdJ|S-qO|E#KN$>+9!Kw~@59@%{26))bT*Y$K8@Qhl zfLWIJPdo%cWOE$v%$Ox@poo$n%YV%rzy@+26JWn(3}A{RiWomTkdAw$!VXVyJnlI@ zZ{6MK_$c$XtWw9s(bHeE{n+F83b*ovIUaG^;beGPM#$L`kO<}%>LheRP_VY5xC)AH zp-!9#7dR6o;_t;}_7zaP0J%r)OFDb_`Tllf3iI!0`_6&PCT%b$&y0XgN`n;GO)H_G zRUbScv-!EEdhth5zPSO47U{CKm?#8n78w^@#jrulG=&TsrL4=gfEOk-pa#HxP&n^Q zG_^8Xz(A5jfn0{^k8}KTXkQq}@;{D!XJ9oPl0TQz&D<=lzTE_u{c2d!Ui13S9q2W= z#{731&UY;puV*?COj%{ggkz4W2!^rfEU-?K60- z82<5DV{#cR>q?lYXOZgEW`~22$BMV#I1L_?yZ_1F)uf9) zb~rw5NfJ4EHoDfwuw8DCziV<53=2_)b@KL79U$rfwFD2LAOhV?mg79IRM!HS%_)g~ z@Nkdk2h_l@Ra9D_TwX$ckqGEyF`Skq4L~>j9P(aB1n}|NW!-8C9;SJWL*^yYUsDVV zN-80XpgD#UO=@D;BG^Jk2=bX&!M@fRw)$Qld^9r3yvfTkRY}X)$}ofA=I^-G{Nrg| zv!uKTu4U+j8OQOQv=he6;z4|@gyv0idpO8)BVoQLfK>`E#Ds4eHK(P~@j!2Dwrgn* zgn3tx*<`quT42};G40{msHH`RB1cw+_Ft_1Io*96Z6&2US}IWr^phDCK`|N$Fks-) z$*>0>229b(6l2DBOaB1>$9GG3ykec{M=Eioi&?QhcS^6)N|q)~Y1F1he^)brb%u3@ zb%u3@b%vAeu_fssKGJv5N%yp*jz_%DP3V8)(E;m#b--Fme+3u-uSS0BNlEAq00000 LNkvXXu0mjfGA>2a literal 0 HcmV?d00001 diff --git a/public/upgrades/icon_module_Torpedoes.png b/public/upgrades/icon_module_Torpedoes.png new file mode 100644 index 0000000000000000000000000000000000000000..69d129f47b20f3e8f171f12cc0970fe77190bb94 GIT binary patch literal 975 zcmV;=12FuFP)bGrv2DkSKv^ve(bFya3olny>$ZSvWWyMv$sybdAFq) zW@dxfJ4xVckm%YD7Wi1^UmcZU5&4ZGzhrr%sTRcj- z9>w-1-Nd6jZ-%iq*{)?QT~9!JlWo(++V#ln?X@?p0@z{W;c$3_iBfevUiP-_Zjb=G zT@mQrbUkUm)lgXA zeK8qWV!seNiLNI|`40i46->{jV`!4lY;#RZ%ym&=$dWYT4)x9;l`3a%dJvEjg(#^udxZ(VrAVTh0+AM!|9 xyCoOd>60?}Fvc_~V6QOFAJjSr-mds7zyO?E!F-ZsB!U=-u^_KA(J_=X2lha}AMY*|(Y+ z=UZiM)dBPB6NC`2^vw@j6gHuBT!bwP+g!C5)taIe!19GxJwZ#h9u?AO`wzCR3B8WT z^F?X&i{zjCcfFZB4}F|t7GV#7E=Km3MDKIT^K}7kQ*Y0Ghkd?ePpv4gm^n;gF|rRo z&~lvjlZMF~`45!P@FQ?bNJ|Mzhw++*V4oVAxwO0j3v+gCdUpOC9^aTL#1R_dOX6C& zz*?}_vbo~V4ML!cM*7OtseK!Eo=o8Uh1WEy?QK+Kycc09B;CgdZ+Y?5X@HuB*EDF^ z8_pZDH|IrIWkcB5j!zHd3St@~3-<2Sws$$=-UGG*3x^RF_U2X+EDL+{E`nkNBDik{ z)~>zXlvd<=@}>911$o9QtTB5ZU21Pxo?9;9KqSO(4A%KKTZOe`Z$i#1p*c6^Y{{N<6D+^dN_U7Dz&E~{!u_MY(;XG4H&91%G?~m83 z?ajFXyCBJbe{$xJA&}PnG!p+#<;Q}Z$9mA(sWZC|*@4xvH@<&!&qr^lYiCliByw?p zDJ;Cb_}BRC;N9)QfS)7xs5(E6{mT!(@||6K>s+5w^Kni_7Mr*rrS82mI;a7gF0E`h zW^b+aEzU{U#hWkBbrACZ{obfu8Nn7Ek(N`ru@kVifmy(^ws$pHTfi(}S=$>@%wo-c zo3%8ns)x0`%dlIHFt3)FR6W$*IzlVkyHy9+Y-H^W>BXwY4lGN1n}Ib2>_*jN*4}1e z4FkJb^%$`?Tt90C))26kjd`A{?|3?K$f>HQn!UC1V`ghwI!^>H4}Ey?t%ylHP4e3s#cksUJtvd$+D{9fIO|1D-3b zDSZyty@Nx~uDy$*bdC3OF)g7P8pbtlOPatsNri;bY-tSkaU5xKx#}@4s2ad}b68M! z2Ikc`9&5llU-eiNR83$)ND!jieD(ATucpW6cf0m(7%HN_#V@dK`eQkQNMS0fzJbb!+S2Q+5K)ix7IS ztnFS6ffB9^Rl5j)a-JeEoJCpbdtAzH&Iq-velvUhAp{J^zu zcKPTzwuld&7K=Zr*+BORa~|2JF3T&D5%;+TPIl3`Q1`l>wvnc6`oSDGyDob2Ve` z&2c_RPQ+0x-d(x%I8YuMZ8Z1phG9OydckekZcA0#d}b;?Ob_TkoY05SUV~);T#eCCx7fP^~X{klSC>x($45wf_Vd05?{4*0e2U!~g&Q07*qoM6N<$f_B>A3jhEB literal 0 HcmV?d00001 diff --git a/src/components/ShellForms/DefaultForms.tsx b/src/components/ShellForms/DefaultForms.tsx index 7a77771..8eac0f0 100644 --- a/src/components/ShellForms/DefaultForms.tsx +++ b/src/components/ShellForms/DefaultForms.tsx @@ -1,8 +1,92 @@ -import React from 'react'; -import {Form} from 'react-bootstrap'; +import React, {useState} from 'react'; +import {Button, Form, Popover, OverlayTrigger, Col} from 'react-bootstrap'; import * as T from '../commonTypes'; import * as S from './Types'; +function UpgradeSingle({active, name, img_target, onClick} : + {active: boolean, name: string, img_target: [string, string], onClick: () => void}){ + return ( +
{onClick()}}> + {name}/ +
{name}
+
); +} + +function UpgradeColumn({column, value, rows_max, img_target, sendValue} : + {column: [string, string, any][], value: number, rows_max: number, img_target: [string, string], sendValue: (index: number) => void}){ + const [value_state, setValue] = useState(value); + const changeSelected = (index: number) => { + if (value_state !== index){ + sendValue(index); + setValue(index); + } + } + + return ( +
+ {column.map((row, i: number) => { + const name = row[1]; + return ( + {changeSelected(i)}}/> + ); + })} + { + Array(rows_max - column.length).fill(
) + } +
+ ); +} + +const upgrade_order = ['_Artillery', '_Hull', '_Torpedoes', '_Suo', '_Engine']; +const upgrade_img_src_table = Object.freeze({ + '_Artillery': ['icon_module_Artillery', 'icon_module_Artillery_installed'], + '_Hull': ['icon_module_Hull', 'icon_module_Hull_installed'], + '_Torpedoes': ['icon_module_Torpedoes', 'icon_module_Torpedoes_installed'], + '_Suo': ['icon_module_Suo', 'icon_module_Suo_installed'], + '_Engine': ['icon_module_Engine', 'icon_module_Engine_installed'] +}); + +const UpgradeTable = React.forwardRef(( + {upgrades, values}: {upgrades: Record, values: Record}, + ref) => { + + const upgrade_lists = Object.entries(upgrades); + const rows_max: number = (()=>{ + let rows_max_current = 0; + upgrade_lists.forEach(([type, data]) => { + rows_max_current = Math.max(rows_max_current, data.length); + }); + return rows_max_current; + })(); + upgrade_lists.sort((a, b) => upgrade_order.indexOf(a[0]) - upgrade_order.indexOf(b[0])); + + const updateValue = (type: string, value: number) => {values[type] = value;} + + console.log('Rendering'); + return ( +
+ {upgrade_lists.map(([type, data], i) => { + console.log(type, data); + return ( + {updateValue(type, index);}} + /> + ); + })} +
+ ); +}); + interface defaultFormProps{ controlId: string, keyProp: number, ariaLabel : string, children : string | JSX.Element, defaultValue: string, defaultOptions: string[], defaultValues: string[], onChange: Function, @@ -62,7 +146,7 @@ export class DefaultForm extends React.PureComponent { return fetch(target) @@ -228,10 +312,119 @@ export class DefaultShips extends React.PureComponent { ); } - const run = () => Object.entries(this.defaultForms).map(singleForm); return run; + //const run = () => Object.entries(this.defaultForms).map(singleForm); return run; + return <> + {singleForm(['version', this.defaultForms.version], 0)} + {singleForm(['nation', this.defaultForms.nation], 1)} + {singleForm(['shipType', this.defaultForms.shipType], 2)} + {singleForm(['ship', this.defaultForms.ship], 3)} + + + + + + } + > + + + {singleForm(['artillery', this.defaultForms.artillery], 4)} + {singleForm(['shellType', this.defaultForms.shellType], 5)} + ; } render(){ - return(<>{this.addDefaultForms()()}); + return(<>{this.addDefaultForms()}); } //componentDidUpdate(){} } From f867bc51251c506867861fd2da1f72a6676edaa6 Mon Sep 17 00:00:00 2001 From: jcw780 <30562395+jcw780@users.noreply.github.com> Date: Sat, 6 Feb 2021 19:32:37 -0500 Subject: [PATCH 2/9] feature: basic component selection working --- src/components/ShellForms/DefaultForms.tsx | 164 ++++++++------------- 1 file changed, 62 insertions(+), 102 deletions(-) diff --git a/src/components/ShellForms/DefaultForms.tsx b/src/components/ShellForms/DefaultForms.tsx index 8eac0f0..6d4d013 100644 --- a/src/components/ShellForms/DefaultForms.tsx +++ b/src/components/ShellForms/DefaultForms.tsx @@ -1,4 +1,4 @@ -import React, {useState} from 'react'; +import React, {useState, useImperativeHandle} from 'react'; import {Button, Form, Popover, OverlayTrigger, Col} from 'react-bootstrap'; import * as T from '../commonTypes'; import * as S from './Types'; @@ -23,9 +23,9 @@ function UpgradeColumn({column, value, rows_max, img_target, sendValue} : } return ( -
+ <> {column.map((row, i: number) => { - const name = row[1]; + const name = row[1] !== "" ? row[1]: row[0]; return (
) } - + ); } @@ -54,29 +54,58 @@ const upgrade_img_src_table = Object.freeze({ const UpgradeTable = React.forwardRef(( {upgrades, values}: {upgrades: Record, values: Record}, ref) => { + const makeUpgradeLists = (raw_upgrades: Record) => { + const upgrade_lists = Object.entries(raw_upgrades); + upgrade_lists.sort((a, b) => upgrade_order.indexOf(a[0]) - upgrade_order.indexOf(b[0])); + return upgrade_lists; + } + const [upgrade_lists, changeUpgradeLists] = useState(makeUpgradeLists(upgrades)); - const upgrade_lists = Object.entries(upgrades); + useImperativeHandle(ref, () => ({ + updateUpgradeListsRaw: (raw_upgrades: Record) => { + changeUpgradeLists(makeUpgradeLists(raw_upgrades)); + } + })); + + const updateSelectedComponents = () => { + const temp: Record = {}; + Object.entries(values).forEach(([k, v]) => { + const current_data = upgrades[k][v][2]; + Object.entries(current_data.components).forEach(([cType, cList]: [string, string[]]) => { + if(cType in temp){ + temp[cType] = temp[cType].filter(value => cList.includes(value)); + }else{ + temp[cType] = cList; + } + }); + + }); + console.log(temp); + + } + + const updateValue = (type: string, value: number) => { + console.log(upgrades[type][value]); + values[type] = value; + updateSelectedComponents(); + } + const rows_max: number = (()=>{ let rows_max_current = 0; - upgrade_lists.forEach(([type, data]) => { + upgrade_lists.forEach(([, data]) => { rows_max_current = Math.max(rows_max_current, data.length); }); return rows_max_current; })(); - upgrade_lists.sort((a, b) => upgrade_order.indexOf(a[0]) - upgrade_order.indexOf(b[0])); - - const updateValue = (type: string, value: number) => {values[type] = value;} - - console.log('Rendering'); + return (
{upgrade_lists.map(([type, data], i) => { - console.log(type, data); return ( {updateValue(type, index);}} @@ -185,6 +214,11 @@ export class DefaultShips extends React.PureComponent { artillery: ['Artillery' , React.createRef(), 4], shellType: ['Shell Type', React.createRef(), 5], }) + + upgradesRef = React.createRef(); + upgrades: Record = {}; + values: Record = {}; + changeForm = async (value: string, id: keyof(defaultFormType)) => { //this.defaultForms[id][singleFormIndex.value] = value; let queryIndex = this.defaultForms[id][singleFormIndex.queryIndex]; @@ -266,6 +300,16 @@ export class DefaultShips extends React.PureComponent { this.updateForm('ship', options, values); } const queryArtillery = () => { + Object.keys(this.upgrades).forEach((key) => { + delete this.upgrades[key]; + delete this.values[key]; + }); + Object.entries(qDataS[nation][type][ship].upgrades).forEach(([k, v]) => { + this.upgrades[k] = v; this.values[k] = 0; + }); + if (this.upgradesRef.current) + this.upgradesRef.current.updateUpgradeListsRaw(this.upgrades); + const options = Object.keys(qDataS[nation][type][ship].artillery); this.updateForm('artillery', options, options); } @@ -313,6 +357,7 @@ export class DefaultShips extends React.PureComponent { ); } //const run = () => Object.entries(this.defaultForms).map(singleForm); return run; + //const {defaultData} = this.props; return <> {singleForm(['version', this.defaultForms.version], 0)} {singleForm(['nation', this.defaultForms.nation], 1)} @@ -321,95 +366,10 @@ export class DefaultShips extends React.PureComponent { - From 0f35613f1f1aaaf8c0d2db781cced0d75e8344c2 Mon Sep 17 00:00:00 2001 From: jcw780 <30562395+jcw780@users.noreply.github.com> Date: Sat, 6 Feb 2021 19:36:08 -0500 Subject: [PATCH 3/9] refactor: moved defaultForms interface into more isolated tsx --- src/components/ShellForms/DefaultForms.tsx | 1 - src/components/ShellForms/Types.tsx | 7 ++++++- src/components/commonTypes.tsx | 6 ------ 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/components/ShellForms/DefaultForms.tsx b/src/components/ShellForms/DefaultForms.tsx index 6d4d013..36db471 100644 --- a/src/components/ShellForms/DefaultForms.tsx +++ b/src/components/ShellForms/DefaultForms.tsx @@ -85,7 +85,6 @@ const UpgradeTable = React.forwardRef(( } const updateValue = (type: string, value: number) => { - console.log(upgrades[type][value]); values[type] = value; updateSelectedComponents(); } diff --git a/src/components/ShellForms/Types.tsx b/src/components/ShellForms/Types.tsx index 52e6475..477a1e1 100644 --- a/src/components/ShellForms/Types.tsx +++ b/src/components/ShellForms/Types.tsx @@ -27,7 +27,12 @@ export interface formDataT extends formTemplate, dispersionTemplate{ + version: T, nation: T, shipType: T, + ship: T, artillery: T, shellType: T, +} + export enum DefaultDataRowI {value, options, values} export type DefaultDataRowT = [string, string[], string[]] interface queriedDataT {queriedData: Record>} -export type defaultDataT = T.defaultFormGeneric & queriedDataT \ No newline at end of file +export type defaultDataT = defaultFormGeneric & queriedDataT \ No newline at end of file diff --git a/src/components/commonTypes.tsx b/src/components/commonTypes.tsx index 5266cf3..29a9d65 100644 --- a/src/components/commonTypes.tsx +++ b/src/components/commonTypes.tsx @@ -15,12 +15,6 @@ export interface styleT{ export type handleValueChangeT = (value: string, id: string | number) => void | string; -//DefaultForms -export interface defaultFormGeneric{ - version: T, nation: T, shipType: T, - ship: T, artillery: T, shellType: T, -} - //Target Data export interface targetDataNoAngleT { armor: number, inclination: number, width: number, From 0c6da8ada18d43f2b4b0ef6747aa9ce6a9e6ff6b Mon Sep 17 00:00:00 2001 From: jcw780 <30562395+jcw780@users.noreply.github.com> Date: Sat, 6 Feb 2021 20:20:49 -0500 Subject: [PATCH 4/9] feature: integrated upgrades into defaultForms updates --- src/components/ShellForms/DefaultForms.tsx | 98 ++++++++++++++-------- src/components/ShellForms/ShellForms.tsx | 4 +- src/components/ShellForms/Types.tsx | 10 ++- 3 files changed, 74 insertions(+), 38 deletions(-) diff --git a/src/components/ShellForms/DefaultForms.tsx b/src/components/ShellForms/DefaultForms.tsx index 36db471..262013e 100644 --- a/src/components/ShellForms/DefaultForms.tsx +++ b/src/components/ShellForms/DefaultForms.tsx @@ -51,8 +51,28 @@ const upgrade_img_src_table = Object.freeze({ '_Engine': ['icon_module_Engine', 'icon_module_Engine_installed'] }); +const updateSelectedComponents = (upgrades: Record, values: Record) => { + const temp: Record = {}; + Object.entries(values).forEach(([k, v]) => { + const current_data = upgrades[k][v][2]; + Object.entries(current_data.components).forEach(([cType, cList]: [string, string[]]) => { + if(cType in temp){ + temp[cType] = temp[cType].filter(value => cList.includes(value)); + }else{ + temp[cType] = cList; + } + }); + + }); + return temp; +} + const UpgradeTable = React.forwardRef(( - {upgrades, values}: {upgrades: Record, values: Record}, + {upgrades, values, onChange}: { + upgrades: Record, + values: Record + onChange: () => void + }, ref) => { const makeUpgradeLists = (raw_upgrades: Record) => { const upgrade_lists = Object.entries(raw_upgrades); @@ -66,27 +86,10 @@ const UpgradeTable = React.forwardRef(( changeUpgradeLists(makeUpgradeLists(raw_upgrades)); } })); - - const updateSelectedComponents = () => { - const temp: Record = {}; - Object.entries(values).forEach(([k, v]) => { - const current_data = upgrades[k][v][2]; - Object.entries(current_data.components).forEach(([cType, cList]: [string, string[]]) => { - if(cType in temp){ - temp[cType] = temp[cType].filter(value => cList.includes(value)); - }else{ - temp[cType] = cList; - } - }); - - }); - console.log(temp); - - } const updateValue = (type: string, value: number) => { values[type] = value; - updateSelectedComponents(); + onChange(); } const rows_max: number = (()=>{ @@ -210,13 +213,11 @@ export class DefaultShips extends React.PureComponent { nation: ['Nation' , React.createRef(), 1], shipType: ['Type' , React.createRef(), 2], ship: ['Ship' , React.createRef(), 3], - artillery: ['Artillery' , React.createRef(), 4], - shellType: ['Shell Type', React.createRef(), 5], + artillery: ['Artillery' , React.createRef(), 5], + shellType: ['Shell Type', React.createRef(), 6], }) upgradesRef = React.createRef(); - upgrades: Record = {}; - values: Record = {}; changeForm = async (value: string, id: keyof(defaultFormType)) => { //this.defaultForms[id][singleFormIndex.value] = value; @@ -228,10 +229,32 @@ export class DefaultShips extends React.PureComponent { } defaultData[id][S.DefaultDataRowI.value] = value; // Now iterative - instead of waiting for rerenders and clogging stack depth - for(; queryIndex <= 5; ++queryIndex){ + for(; queryIndex <= 6; ++queryIndex){ + this.postVersion(queryIndex)(); + } + } + changeUpgrades = () => { + this.updateUpgrades(); + for(let queryIndex = 4; queryIndex <= 6; ++queryIndex){ this.postVersion(queryIndex)(); } } + updateUpgrades = () => { + const {upgrades, values} = this.props.defaultData; + const temp: Record = {}; + Object.entries(values).forEach(([k, v]) => { + const current_data = upgrades[k][v][2]; + Object.entries(current_data.components).forEach(([cType, cList]: [string, string[]]) => { + if(cType in temp){ + temp[cType] = temp[cType].filter(value => cList.includes(value)); + }else{ + temp[cType] = cList; + } + }); + }); + this.props.defaultData.components = temp; + console.log(this.props.defaultData.components); + } updateForm = (target: keyof(defaultFormType), options: string[], values: string[]) => { const {current} = this.defaultForms[target][singleFormIndex.ref]; if(current){ @@ -298,18 +321,22 @@ export class DefaultShips extends React.PureComponent { } this.updateForm('ship', options, values); } - const queryArtillery = () => { - Object.keys(this.upgrades).forEach((key) => { - delete this.upgrades[key]; - delete this.values[key]; + const queryUpgrades = () => { + const {upgrades, values} = this.props.defaultData; + Object.keys(upgrades).forEach((key) => { + delete upgrades[key]; + delete values[key]; }); Object.entries(qDataS[nation][type][ship].upgrades).forEach(([k, v]) => { - this.upgrades[k] = v; this.values[k] = 0; + upgrades[k] = v; values[k] = 0; }); + this.updateUpgrades(); if (this.upgradesRef.current) - this.upgradesRef.current.updateUpgradeListsRaw(this.upgrades); - - const options = Object.keys(qDataS[nation][type][ship].artillery); + this.upgradesRef.current.updateUpgradeListsRaw(upgrades); + } + const queryArtillery = () => { + //const options = Object.keys(qDataS[nation][type][ship].artillery); + const options = dData.components.artillery !== undefined ? dData.components.artillery: []; this.updateForm('artillery', options, options); } const queryShellType = () => { @@ -332,7 +359,7 @@ export class DefaultShips extends React.PureComponent { this.props.sendDefault({...dData.queriedData.shells[shellName], ...dispersionData}, name); } const queries = [ - queryNation, queryType, queryShip, + queryNation, queryType, queryShip, queryUpgrades, queryArtillery, queryShellType, sendData ]; return queries[index]; @@ -367,8 +394,9 @@ export class DefaultShips extends React.PureComponent { diff --git a/src/components/ShellForms/ShellForms.tsx b/src/components/ShellForms/ShellForms.tsx index 94823bc..1b95c59 100644 --- a/src/components/ShellForms/ShellForms.tsx +++ b/src/components/ShellForms/ShellForms.tsx @@ -28,7 +28,9 @@ export class ShellForms extends React.PureComponent { defaultData : S.defaultDataT = Object.seal({ version: ['', [''], ['']], nation: ['', [''], ['']], shipType: ['', [''], ['']], ship: ['', [''], ['']], artillery: ['', [''], ['']], shellType: ['', [''], ['']], - queriedData: {} + queriedData: {}, + + upgrades: {}, values: {}, components: {} }); formData : S.formDataT = Object.seal({ caliber: 0, muzzleVelocity: 0, dragCoefficient: 0, diff --git a/src/components/ShellForms/Types.tsx b/src/components/ShellForms/Types.tsx index 477a1e1..73f4e83 100644 --- a/src/components/ShellForms/Types.tsx +++ b/src/components/ShellForms/Types.tsx @@ -34,5 +34,11 @@ export interface defaultFormGeneric{ export enum DefaultDataRowI {value, options, values} export type DefaultDataRowT = [string, string[], string[]] -interface queriedDataT {queriedData: Record>} -export type defaultDataT = defaultFormGeneric & queriedDataT \ No newline at end of file +interface queriedDataT { + queriedData: Record> +} +interface upgradeDataT { + upgrades: Record, values: Record, + components: Record +} +export type defaultDataT = defaultFormGeneric & queriedDataT & upgradeDataT \ No newline at end of file From 16e41f3909938fbf0b50c7712781dbe71571df80 Mon Sep 17 00:00:00 2001 From: jcw780 <30562395+jcw780@users.noreply.github.com> Date: Sat, 6 Feb 2021 20:32:31 -0500 Subject: [PATCH 5/9] feature: added fcs modifiers --- src/components/ShellForms/DefaultForms.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/components/ShellForms/DefaultForms.tsx b/src/components/ShellForms/DefaultForms.tsx index 262013e..9bd540a 100644 --- a/src/components/ShellForms/DefaultForms.tsx +++ b/src/components/ShellForms/DefaultForms.tsx @@ -253,7 +253,6 @@ export class DefaultShips extends React.PureComponent { }); }); this.props.defaultData.components = temp; - console.log(this.props.defaultData.components); } updateForm = (target: keyof(defaultFormType), options: string[], values: string[]) => { const {current} = this.defaultForms[target][singleFormIndex.ref]; @@ -356,6 +355,12 @@ export class DefaultShips extends React.PureComponent { name = qDataS[nation][type][ship].Name } + if('fireControl' in dData.components){ + const fireControlSystem = dData.components.fireControl[0]; + const fireControlParameters = qDataS[nation][type][ship].fireControl[fireControlSystem]; + dispersionData.maxDist *= fireControlParameters.maxDistCoef; + dispersionData.sigmaCount *= fireControlParameters.sigmaCountCoef; + } this.props.sendDefault({...dData.queriedData.shells[shellName], ...dispersionData}, name); } const queries = [ From 60990fbf1f9feed35f54fb60d4c76d93ea7da2ac Mon Sep 17 00:00:00 2001 From: jcw780 <30562395+jcw780@users.noreply.github.com> Date: Sat, 6 Feb 2021 20:55:36 -0500 Subject: [PATCH 6/9] fix: fixed ship upgrade items breaking column alignment --- src/components/ShellForms/DefaultForms.tsx | 29 ++++++---------------- 1 file changed, 8 insertions(+), 21 deletions(-) diff --git a/src/components/ShellForms/DefaultForms.tsx b/src/components/ShellForms/DefaultForms.tsx index 9bd540a..27cc38d 100644 --- a/src/components/ShellForms/DefaultForms.tsx +++ b/src/components/ShellForms/DefaultForms.tsx @@ -8,7 +8,7 @@ function UpgradeSingle({active, name, img_target, onClick} : return (
{onClick()}}> {name}/ -
{name}
+
{name}
); } @@ -23,7 +23,7 @@ function UpgradeColumn({column, value, rows_max, img_target, sendValue} : } return ( - <> +
{column.map((row, i: number) => { const name = row[1] !== "" ? row[1]: row[0]; return ( @@ -38,7 +38,7 @@ function UpgradeColumn({column, value, rows_max, img_target, sendValue} : { Array(rows_max - column.length).fill(
) } - +
); } @@ -51,22 +51,6 @@ const upgrade_img_src_table = Object.freeze({ '_Engine': ['icon_module_Engine', 'icon_module_Engine_installed'] }); -const updateSelectedComponents = (upgrades: Record, values: Record) => { - const temp: Record = {}; - Object.entries(values).forEach(([k, v]) => { - const current_data = upgrades[k][v][2]; - Object.entries(current_data.components).forEach(([cType, cList]: [string, string[]]) => { - if(cType in temp){ - temp[cType] = temp[cType].filter(value => cList.includes(value)); - }else{ - temp[cType] = cList; - } - }); - - }); - return temp; -} - const UpgradeTable = React.forwardRef(( {upgrades, values, onChange}: { upgrades: Record, @@ -101,7 +85,11 @@ const UpgradeTable = React.forwardRef(( })(); return ( -
+
{upgrade_lists.map(([type, data], i) => { return ( { this.upgradesRef.current.updateUpgradeListsRaw(upgrades); } const queryArtillery = () => { - //const options = Object.keys(qDataS[nation][type][ship].artillery); const options = dData.components.artillery !== undefined ? dData.components.artillery: []; this.updateForm('artillery', options, options); } From 5a57614c64e64e4c2ad41e64bdd7b53849d457f5 Mon Sep 17 00:00:00 2001 From: jcw780 <30562395+jcw780@users.noreply.github.com> Date: Sat, 6 Feb 2021 21:21:57 -0500 Subject: [PATCH 7/9] refactor: moved upgradeforms to another file --- src/components/ShellForms/DefaultForms.tsx | 109 +------------------- src/components/ShellForms/UpgradeForms.tsx | 111 +++++++++++++++++++++ 2 files changed, 115 insertions(+), 105 deletions(-) create mode 100644 src/components/ShellForms/UpgradeForms.tsx diff --git a/src/components/ShellForms/DefaultForms.tsx b/src/components/ShellForms/DefaultForms.tsx index 27cc38d..632c3e6 100644 --- a/src/components/ShellForms/DefaultForms.tsx +++ b/src/components/ShellForms/DefaultForms.tsx @@ -1,110 +1,8 @@ -import React, {useState, useImperativeHandle} from 'react'; -import {Button, Form, Popover, OverlayTrigger, Col} from 'react-bootstrap'; +import React from 'react'; +import {Button, Form, Popover, OverlayTrigger} from 'react-bootstrap'; import * as T from '../commonTypes'; import * as S from './Types'; - -function UpgradeSingle({active, name, img_target, onClick} : - {active: boolean, name: string, img_target: [string, string], onClick: () => void}){ - return ( -
{onClick()}}> - {name}/ -
{name}
-
); -} - -function UpgradeColumn({column, value, rows_max, img_target, sendValue} : - {column: [string, string, any][], value: number, rows_max: number, img_target: [string, string], sendValue: (index: number) => void}){ - const [value_state, setValue] = useState(value); - const changeSelected = (index: number) => { - if (value_state !== index){ - sendValue(index); - setValue(index); - } - } - - return ( -
- {column.map((row, i: number) => { - const name = row[1] !== "" ? row[1]: row[0]; - return ( - {changeSelected(i)}}/> - ); - })} - { - Array(rows_max - column.length).fill(
) - } -
- ); -} - -const upgrade_order = ['_Artillery', '_Hull', '_Torpedoes', '_Suo', '_Engine']; -const upgrade_img_src_table = Object.freeze({ - '_Artillery': ['icon_module_Artillery', 'icon_module_Artillery_installed'], - '_Hull': ['icon_module_Hull', 'icon_module_Hull_installed'], - '_Torpedoes': ['icon_module_Torpedoes', 'icon_module_Torpedoes_installed'], - '_Suo': ['icon_module_Suo', 'icon_module_Suo_installed'], - '_Engine': ['icon_module_Engine', 'icon_module_Engine_installed'] -}); - -const UpgradeTable = React.forwardRef(( - {upgrades, values, onChange}: { - upgrades: Record, - values: Record - onChange: () => void - }, - ref) => { - const makeUpgradeLists = (raw_upgrades: Record) => { - const upgrade_lists = Object.entries(raw_upgrades); - upgrade_lists.sort((a, b) => upgrade_order.indexOf(a[0]) - upgrade_order.indexOf(b[0])); - return upgrade_lists; - } - const [upgrade_lists, changeUpgradeLists] = useState(makeUpgradeLists(upgrades)); - - useImperativeHandle(ref, () => ({ - updateUpgradeListsRaw: (raw_upgrades: Record) => { - changeUpgradeLists(makeUpgradeLists(raw_upgrades)); - } - })); - - const updateValue = (type: string, value: number) => { - values[type] = value; - onChange(); - } - - const rows_max: number = (()=>{ - let rows_max_current = 0; - upgrade_lists.forEach(([, data]) => { - rows_max_current = Math.max(rows_max_current, data.length); - }); - return rows_max_current; - })(); - - return ( -
- {upgrade_lists.map(([type, data], i) => { - return ( - {updateValue(type, index);}} - /> - ); - })} -
- ); -}); +import {UpgradeTable} from './UpgradeForms'; interface defaultFormProps{ controlId: string, keyProp: number, ariaLabel : string, children : string | JSX.Element, @@ -388,6 +286,7 @@ export class DefaultShips extends React.PureComponent { ref={this.upgradesRef} upgrades={this.props.defaultData.upgrades} values={this.props.defaultData.values} + localized={this.props.formatSettings.shortNames} onChange={this.changeUpgrades} /> diff --git a/src/components/ShellForms/UpgradeForms.tsx b/src/components/ShellForms/UpgradeForms.tsx new file mode 100644 index 0000000..e0bf4fa --- /dev/null +++ b/src/components/ShellForms/UpgradeForms.tsx @@ -0,0 +1,111 @@ +import React, {useState, useImperativeHandle} from 'react'; + +function UpgradeSingle({active, name, img_target, onClick} : + {active: boolean, name: string, img_target: [string, string], onClick: () => void}){ + return ( +
{onClick()}}> + {name}/ +
{name}
+
); +} + +function UpgradeColumn({column, value, rows_max, img_target, localized, sendValue} : { + column: [string, string, any][], + value: number, + rows_max: number, + img_target: [string, string], + localized: boolean, + sendValue: (index: number) => void}){ + const [value_state, setValue] = useState(value); + const changeSelected = (index: number) => { + if (value_state !== index){ + sendValue(index); + setValue(index); + } + } + + return ( +
+ {column.map((row, i: number) => { + const name = (row[1] !== "") && localized ? row[1]: row[0]; + return ( + {changeSelected(i)}}/> + ); + })} + { + Array(rows_max - column.length).fill(
) + } +
+ ); +} + +const upgrade_order = ['_Artillery', '_Hull', '_Torpedoes', '_Suo', '_Engine']; +const upgrade_img_src_table = Object.freeze({ + '_Artillery': ['icon_module_Artillery', 'icon_module_Artillery_installed'], + '_Hull': ['icon_module_Hull', 'icon_module_Hull_installed'], + '_Torpedoes': ['icon_module_Torpedoes', 'icon_module_Torpedoes_installed'], + '_Suo': ['icon_module_Suo', 'icon_module_Suo_installed'], + '_Engine': ['icon_module_Engine', 'icon_module_Engine_installed'] +}); + +export const UpgradeTable = React.forwardRef(( + {upgrades, values, localized, onChange}: { + upgrades: Record, + values: Record, + localized: boolean, + onChange: () => void, + }, + ref) => { + const makeUpgradeLists = (raw_upgrades: Record) => { + const upgrade_lists = Object.entries(raw_upgrades); + upgrade_lists.sort((a, b) => upgrade_order.indexOf(a[0]) - upgrade_order.indexOf(b[0])); + return upgrade_lists; + } + const [upgrade_lists, changeUpgradeLists] = useState(makeUpgradeLists(upgrades)); + + useImperativeHandle(ref, () => ({ + updateUpgradeListsRaw: (raw_upgrades: Record) => { + changeUpgradeLists(makeUpgradeLists(raw_upgrades)); + } + })); + + const updateValue = (type: string, value: number) => { + values[type] = value; + onChange(); + } + + const rows_max: number = (()=>{ + let rows_max_current = 0; + upgrade_lists.forEach(([, data]) => { + rows_max_current = Math.max(rows_max_current, data.length); + }); + return rows_max_current; + })(); + + return ( +
+ {upgrade_lists.map(([type, data], i) => { + return ( + {updateValue(type, index);}} + /> + ); + })} +
+ ); +}); \ No newline at end of file From a0784fdfabb3b6a6fd92f1b3753f88bf33c38f8d Mon Sep 17 00:00:00 2001 From: jcw780 <30562395+jcw780@users.noreply.github.com> Date: Sat, 6 Feb 2021 21:23:26 -0500 Subject: [PATCH 8/9] 2.3.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 65ec93f..cf84050 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "wows_ballistics", - "version": "2.2.12", + "version": "2.3.0", "private": true, "license": "MIT", "homepage": "http://jcw780.github.io/wows_ballistics", From 80c79ec699d0a61d0265950ed33c6f30262bce2a Mon Sep 17 00:00:00 2001 From: jcw780 <30562395+jcw780@users.noreply.github.com> Date: Sat, 6 Feb 2021 21:23:35 -0500 Subject: [PATCH 9/9] update version --- HISTORY.md | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/HISTORY.md b/HISTORY.md index 2b7b558..b6b6741 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -7,7 +7,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 Generated by [`auto-changelog`](https://github.com/CookPete/auto-changelog). -## [v2.2.12](https://github.com/jcw780/wows_ballistics/compare/v2.2.11...v2.2.12) +## [v2.3.0](https://github.com/jcw780/wows_ballistics/compare/v2.2.12...v2.3.0) + +### Merged + +- Basic modifiers [`#54`](https://github.com/jcw780/wows_ballistics/pull/54) +- Basic modifiers [`#53`](https://github.com/jcw780/wows_ballistics/pull/53) + +### Commits + +- refactor: moved upgradeforms to another file [`5a57614`](https://github.com/jcw780/wows_ballistics/commit/5a57614c64e64e4c2ad41e64bdd7b53849d457f5) +- feature: ship upgrades basic UI complete [`d5b11ac`](https://github.com/jcw780/wows_ballistics/commit/d5b11acdfdb13b66040ddc41b9ae653e3fd7a76d) +- feature: basic component selection working [`f867bc5`](https://github.com/jcw780/wows_ballistics/commit/f867bc51251c506867861fd2da1f72a6676edaa6) +- feature: integrated upgrades into defaultForms updates [`0c6da8a`](https://github.com/jcw780/wows_ballistics/commit/0c6da8ada18d43f2b4b0ef6747aa9ce6a9e6ff6b) +- fix: fixed ship upgrade items breaking column alignment [`60990fb`](https://github.com/jcw780/wows_ballistics/commit/60990fbf1f9feed35f54fb60d4c76d93ea7da2ac) +- update version [`4723614`](https://github.com/jcw780/wows_ballistics/commit/4723614e9079f902911745e3343165ec72c81c88) +- refactor: moved defaultForms interface into more isolated tsx [`0f35613`](https://github.com/jcw780/wows_ballistics/commit/0f35613f1f1aaaf8c0d2db781cced0d75e8344c2) +- feature: added fcs modifiers [`16e41f3`](https://github.com/jcw780/wows_ballistics/commit/16e41f3909938fbf0b50c7712781dbe71571df80) + +## [v2.2.12](https://github.com/jcw780/wows_ballistics/compare/v2.2.11...v2.2.12) - 2021-01-31 ### Merged