Skip to content

Commit aa2de41

Browse files
committed
Finiliazing project and version 0.5 ready for production and showcase
1 parent 0945c24 commit aa2de41

File tree

17 files changed

+97
-48
lines changed

17 files changed

+97
-48
lines changed

src/main/java/blockmatrix/controllers/Blockmatrix_RestController.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,10 @@ public ResponseEntity<String> send_funds(@RequestParam(value = "funds", required
187187
}
188188

189189
@RequestMapping(path = "/modify_transaction_info")
190-
public void modify_transaction_info(@RequestParam(value = "num", required = true, defaultValue = "1") int blockNumber,
191-
@RequestParam(value = "transaction", required = true, defaultValue = "0") int transactionNumber,
192-
@RequestParam(value = "new_info", required = true, defaultValue = "null") String new_info) {
193-
new_blockMatrix.modifyTXinfo_InBM(blockNumber, transactionNumber, new_info);
190+
public void modify_transaction_info(@RequestParam(value = "num", required = true, defaultValue = "null") int blockNumber,
191+
@RequestParam(value = "transaction", required = true, defaultValue = "null") String txId,
192+
@RequestParam(value = "new_info", required = true, defaultValue = "null") String newTxInfo) {
193+
new_blockMatrix.modifyTXinfo_InBM(blockNumber, txId, newTxInfo);
194194
}
195195

196196
// @Scheduled(fixedRate = 10000) // ms = (60 sec)

src/main/java/blockmatrix/model/Block.java

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -88,14 +88,12 @@ public boolean add_Transaction_To_Block(Transaction transaction) {
8888
return true;
8989
}
9090

91-
public void clear_Transaction_Info_In_Block(int transactionNumber) {
92-
transactions.get(transactionNumber).clear_Transaction_Info();
93-
merkleRoot = StringUtil.getMerkleRoot(transactions);
94-
this.hash = calculate_Block_Hash();
95-
}
96-
97-
public void modifyTX_InfoInBlock(int transactionNumber, String new_transaction_info){
98-
transactions.get(transactionNumber).modifyTX(new_transaction_info);
91+
public void modifyTX_InfoInBlock(String txId, String newTxInfo){
92+
for (Transaction tx : transactions) {
93+
if (tx.getTransactionId().equals(txId)) {
94+
tx.modifyTX(newTxInfo);
95+
}
96+
}
9997
merkleRoot = StringUtil.getMerkleRoot(transactions);
10098
this.hash = calculate_Block_Hash();
10199
}

src/main/java/blockmatrix/model/BlockMatrix.java

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,18 +160,15 @@ private void update_Column_Hash(int column) {
160160
columnHashes[column] = calculate_Column_Hash(column);
161161
}
162162

163-
public void modifyTXinfo_InBM(int blockNumber, int transactionNumber, String new_transaction_info) {
163+
public void modifyTXinfo_InBM(int blockNumber, String txId, String newTxInfo) {
164+
164165
// the "delete" function, which will overwrite and message info passed in along with the transaction for every transaction in the block
165166

166167
this.blocksWithModifiedData.add(blockNumber); // Add 'this' block to a list to keep track of all modified blocks
167168
int row = get_Block_Row_Index(blockNumber); // ..
168169
int column = get_Block_Column_Index(blockNumber); // ..
169170

170-
if (new_transaction_info.equals("null")) {
171-
getBlock(blockNumber).clear_Transaction_Info_In_Block(transactionNumber); // Clear the transaction in that particular block
172-
} else {
173-
getBlock(blockNumber).modifyTX_InfoInBlock(transactionNumber, new_transaction_info); // Modify the transaction in that particular block
174-
}
171+
getBlock(blockNumber).modifyTX_InfoInBlock(txId, newTxInfo); // Modify the transaction in that particular block
175172

176173
String[] prevRowHashes = this.getRowHashes().clone();
177174
String[] prevColumnHashes = this.getColumnHashes().clone();

src/main/java/blockmatrix/model/Transaction.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -144,11 +144,6 @@ public float get_OutputsValue() {
144144
return total;
145145
}
146146

147-
public void clear_Transaction_Info() {
148-
this.info = "CLEARED";
149-
this.transactionId = calculate_Transaction_Hash();
150-
}
151-
152147
public void modifyTX(String new_info){
153148
this.info = new_info;
154149
this.transactionId = calculate_Transaction_Hash();
Lines changed: 3 additions & 0 deletions
Loading

src/main/resources/static/images/Vectors.svg

Lines changed: 12 additions & 0 deletions
Loading

src/main/resources/static/js/main.js

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -57,20 +57,16 @@ if (path_url.includes('/block_explorer')) {
5757
// Event Listeners
5858
// -------------------------
5959

60-
document.getElementById('view_keys').addEventListener('click', submitTX)
60+
// document.getElementById('view_keys').addEventListener('click', submitTX)
6161
document.getElementById('new_wallet').addEventListener('click', createNewWallet)
62-
document.getElementById('access_wallet').addEventListener('click', submitTX)
62+
//TODO: document.getElementById('access_wallet').addEventListener('click', submitTX)
6363
document.getElementById('sendTx').addEventListener('click', submitTX)
6464
document.getElementById('show_more_btn').addEventListener('click', showMoreTx)
6565

6666
document.getElementById('cpy_pub_add').addEventListener('click', function () {
6767
copyClipboard(this)
6868
})
6969

70-
document.getElementById('select_tx_btn').addEventListener('click', function () {
71-
clearData(this)
72-
})
73-
7470
document.getElementById('user_action_btn').addEventListener('mouseout', function () {
7571
document.getElementById('_btn_div_action_txt').style.visibility = 'hidden'
7672
})
@@ -82,6 +78,14 @@ if (path_url.includes('/block_explorer')) {
8278
showBtnFunc(this)
8379
})
8480
}
81+
82+
var btns_arrs_table = document.getElementsByClassName('_btn_modifyTX')
83+
84+
for (let i = 0; i < btns_arrs_table.length; i++) {
85+
btns_arrs_table[i].addEventListener('click', function () {
86+
clearData(this)
87+
})
88+
}
8589
}
8690

8791
// -------------------------
@@ -96,6 +100,9 @@ function showMoreTx() {
96100
rows_arr[i].classList.toggle('display_row');
97101
}
98102
}
103+
104+
document.getElementById('showMore').classList.toggle('enabled')
105+
document.getElementById('showLess').classList.toggle('enabled')
99106
}
100107

101108
function changeInputTxt(x) {
@@ -194,13 +201,13 @@ async function submitTX() {
194201
async function clearData(x) {
195202

196203
var block_num = x.parentNode.parentNode.getElementsByTagName("td")[5].innerHTML
197-
// var transaction_num = x.parentNode.parentNode.getElementsByTagName("strong")[5].innerHTML
204+
var txId = x.parentNode.parentNode.getElementsByTagName("td")[0].innerHTML
198205
var new_info = "null"
199206

200207
var url = new URL("/modify_transaction_info", document.URL),
201208
params = {
202209
num: block_num,
203-
transaction: 0,
210+
transaction: txId,
204211
new_info: new_info
205212
}
206213
Object.keys(params).forEach(key => url.searchParams.append(key, params[key]))

src/main/resources/static/styles/main.css

Lines changed: 12 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/resources/static/styles/main.css.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main/resources/static/styles/sass/_buttons.sass

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
background-color: $primary_light;
2727
color: $secondary_dark;
2828
border: 1px solid $secondary_dark;
29+
outline: none;
2930

3031
& svg path
3132
stroke: $secondary_dark;

src/main/resources/static/styles/sass/_layout.sass

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,17 @@ h1, h2, h3, h4, h5, h6
2323
weight: bold;
2424
margin: 0px;
2525

26+
// ------------------
27+
// Global Project Effects
28+
// ------------------
29+
.overflow
30+
overflow: hidden;
31+
text-overflow: ellipsis;
32+
max-width: 100%;
33+
background-image: linear-gradient(90deg,#000000 35%,rgba(0,0,0,0));
34+
-webkit-background-clip: text;
35+
-webkit-text-fill-color: transparent;
36+
2637
// ------------------
2738
// Main Container Style(s)
2839
// ------------------

src/main/resources/static/styles/sass/_table.sass

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ table
1616
transition-duration: .5s;
1717
cursor: pointer;
1818

19-
& td
19+
& td:nth-child(-n+6)
2020
font:
2121
family: 'Open Sans';
2222
size: 14px;

src/main/resources/templates/html/block_explorer.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<svg width="22" height="21" viewbox="0 0 22 21" fill="none" xmlns="http://www.w3.org/2000/svg">
1919
<path d="M20.3315 11.1459L16.0512 9.17561V7.39679C15.5928 7.16331 15.1756 6.85664 14.8159 6.48885V9.16944L10.8444 11.0224V6.27267C10.9188 6.26874 10.9919 6.25202 11.0606 6.22326L13.8277 4.95091C13.6737 4.55437 13.574 4.13885 13.5312 3.71561L10.8012 4.95091L7.6512 3.53032L10.8012 2.07885L13.5065 3.31414V3.26473C13.5066 2.84736 13.5626 2.43188 13.6733 2.02944L11.0483 0.843555C10.967 0.805928 10.8784 0.786438 10.7888 0.786438C10.6993 0.786438 10.6107 0.805928 10.5294 0.843555L5.89708 2.97444C5.78987 3.02405 5.69914 3.10338 5.63564 3.203C5.57215 3.30262 5.53856 3.41836 5.53885 3.5365V9.18179L1.27708 11.1459C1.16987 11.1955 1.07914 11.2748 1.01564 11.3745C0.952149 11.4741 0.918556 11.5898 0.918848 11.708V17.7486C0.918556 17.8667 0.952149 17.9824 1.01564 18.0821C1.07914 18.1817 1.16987 18.261 1.27708 18.3106L5.90944 20.4415C5.99074 20.4791 6.07926 20.4986 6.16885 20.4986C6.25844 20.4986 6.34696 20.4791 6.42826 20.4415L10.8012 18.428L15.1741 20.4415C15.2554 20.4791 15.344 20.4986 15.4336 20.4986C15.5231 20.4986 15.6117 20.4791 15.693 20.4415L20.3253 18.3106C20.4325 18.261 20.5233 18.1817 20.5868 18.0821C20.6503 17.9824 20.6838 17.8667 20.6836 17.7486V11.708C20.6844 11.5905 20.6517 11.4752 20.5894 11.3757C20.527 11.2761 20.4376 11.1964 20.3315 11.1459ZM3.03738 11.708L6.19355 10.2503L9.34973 11.7018L6.16885 13.1471L3.03738 11.708ZM6.16885 19.2V14.4503C6.25482 14.4439 6.33872 14.4208 6.41591 14.3824L10.1712 12.653V17.3471L6.16885 19.2ZM12.2836 11.708L15.4397 10.2565L18.5959 11.708L15.4397 13.1471L12.2836 11.708ZM15.4583 19.2V14.4503C15.5364 14.4438 15.6122 14.4206 15.6806 14.3824L19.4359 12.653V17.3471L15.4583 19.2Z" fill="white"></path>
2020
<path d="M18.139 6.35292C19.8445 6.35292 21.2272 4.97027 21.2272 3.26469C21.2272 1.5591 19.8445 0.176453 18.139 0.176453C16.4334 0.176453 15.0507 1.5591 15.0507 3.26469C15.0507 4.97027 16.4334 6.35292 18.139 6.35292Z" fill="#00A3FF"></path>
21-
</svg><span class="ml-2">BlockMatrix Status |</span><span th:text="${bm_verify}"> </span>
21+
</svg><span class="ml-2 mr-1">BlockMatrix Status | </span><span th:text="${bm_verify}"> </span>
2222
</div>
2323
</div>
2424
<div class="container-fluid pb-3 pt-0 pl-5">

src/main/resources/templates/html/wallet_ui.html

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<svg width="22" height="21" viewbox="0 0 22 21" fill="none" xmlns="http://www.w3.org/2000/svg">
1919
<path d="M20.3315 11.1459L16.0512 9.17561V7.39679C15.5928 7.16331 15.1756 6.85664 14.8159 6.48885V9.16944L10.8444 11.0224V6.27267C10.9188 6.26874 10.9919 6.25202 11.0606 6.22326L13.8277 4.95091C13.6737 4.55437 13.574 4.13885 13.5312 3.71561L10.8012 4.95091L7.6512 3.53032L10.8012 2.07885L13.5065 3.31414V3.26473C13.5066 2.84736 13.5626 2.43188 13.6733 2.02944L11.0483 0.843555C10.967 0.805928 10.8784 0.786438 10.7888 0.786438C10.6993 0.786438 10.6107 0.805928 10.5294 0.843555L5.89708 2.97444C5.78987 3.02405 5.69914 3.10338 5.63564 3.203C5.57215 3.30262 5.53856 3.41836 5.53885 3.5365V9.18179L1.27708 11.1459C1.16987 11.1955 1.07914 11.2748 1.01564 11.3745C0.952149 11.4741 0.918556 11.5898 0.918848 11.708V17.7486C0.918556 17.8667 0.952149 17.9824 1.01564 18.0821C1.07914 18.1817 1.16987 18.261 1.27708 18.3106L5.90944 20.4415C5.99074 20.4791 6.07926 20.4986 6.16885 20.4986C6.25844 20.4986 6.34696 20.4791 6.42826 20.4415L10.8012 18.428L15.1741 20.4415C15.2554 20.4791 15.344 20.4986 15.4336 20.4986C15.5231 20.4986 15.6117 20.4791 15.693 20.4415L20.3253 18.3106C20.4325 18.261 20.5233 18.1817 20.5868 18.0821C20.6503 17.9824 20.6838 17.8667 20.6836 17.7486V11.708C20.6844 11.5905 20.6517 11.4752 20.5894 11.3757C20.527 11.2761 20.4376 11.1964 20.3315 11.1459ZM3.03738 11.708L6.19355 10.2503L9.34973 11.7018L6.16885 13.1471L3.03738 11.708ZM6.16885 19.2V14.4503C6.25482 14.4439 6.33872 14.4208 6.41591 14.3824L10.1712 12.653V17.3471L6.16885 19.2ZM12.2836 11.708L15.4397 10.2565L18.5959 11.708L15.4397 13.1471L12.2836 11.708ZM15.4583 19.2V14.4503C15.5364 14.4438 15.6122 14.4206 15.6806 14.3824L19.4359 12.653V17.3471L15.4583 19.2Z" fill="white"></path>
2020
<path d="M18.139 6.35292C19.8445 6.35292 21.2272 4.97027 21.2272 3.26469C21.2272 1.5591 19.8445 0.176453 18.139 0.176453C16.4334 0.176453 15.0507 1.5591 15.0507 3.26469C15.0507 4.97027 16.4334 6.35292 18.139 6.35292Z" fill="#00A3FF"></path>
21-
</svg><span class="ml-2">BlockMatrix Status |</span><span th:text="${bm_verify}"> </span>
21+
</svg><span class="ml-2 mr-1">BlockMatrix Status | </span><span th:text="${bm_verify}"> </span>
2222
</div>
2323
</div>
2424
<div class="container-fluid pb-3 pt-0 pl-5">
@@ -125,16 +125,23 @@ <h4>My Transaction History</h4></span>
125125
<td th:text="${tsx.getInfo()}"></td>
126126
<td th:text="${tsx.getBlockNumber()}"></td>
127127
<td>
128-
<button class="button_main_dark" id="select_tx_btn">Modify Info</button>
128+
<button class="_btn_modifyTX button_main_dark">Modify Info</button>
129129
</td>
130130
</tr>
131131
</tbody>
132132
</table>
133133
<div class="container" style="display: flex; justify-content: center;">
134-
<button class="button_main_dark mb-4" id="show_more_btn"><span class="mr-2">Show More</span>
135-
<svg width="12" height="9" viewbox="0 0 12 9" fill="none" xmlns="http://www.w3.org/2000/svg">
136-
<path d="M1.5 1L5.31502 6.70623C5.71971 7.31153 6.61494 7.29524 6.99733 6.67562L10.5 1" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path>
137-
</svg>
134+
<button class="button_main_dark mb-4" id="show_more_btn">
135+
<div class="enabled" id="showMore" style="display: none;"><span class="mr-2">Show More</span>
136+
<svg width="12" height="9" viewbox="0 0 12 9" fill="none" xmlns="http://www.w3.org/2000/svg">
137+
<path d="M1.5 1L5.31502 6.70623C5.71971 7.31153 6.61494 7.29524 6.99733 6.67562L10.5 1" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path>
138+
</svg>
139+
</div>
140+
<div id="showLess" style="display: none;"><span class="mr-2">Show Less</span>
141+
<svg width="12" height="9" viewbox="0 0 12 9" fill="none" xmlns="http://www.w3.org/2000/svg">
142+
<path d="M10.5 8L6.68498 2.29377C6.28029 1.68847 5.38506 1.70476 5.00267 2.32438L1.5 8" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path>
143+
</svg>
144+
</div>
138145
</button>
139146
</div>
140147
</div>
@@ -168,7 +175,7 @@ <h5 class="modal-title" id="exampleModalLabel">New Transaction Message</h5>
168175
<h5 class="modal-title" id="staticBackdropLabel">New Wallet Details</h5>
169176
<button class="close" type="button" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
170177
</div>
171-
<div class="modal-body" id="wallet_info">
178+
<div class="modal-body overflow" id="wallet_info">
172179
<p>Modal body text goes here.</p>
173180
</div>
174181
<div class="modal-footer">

src/main/resources/templates/pug/includes/modal_newWallet.pug

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
h5#staticBackdropLabel.modal-title New Wallet Details
99
button.close(type='button' data-dismiss='modal' aria-label='Close')
1010
span(aria-hidden='true') &times;
11-
#wallet_info.modal-body
11+
#wallet_info.modal-body.overflow
1212
p Modal body text goes here.
1313
.modal-footer
1414
button.btn.btn-secondary(type='button' data-dismiss='modal') I have stored the wallet keys somewhere safe

src/main/resources/templates/pug/includes/table_wallet_user_txs.pug

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,17 @@
1818
td(th:text="${tsx.getInfo()}")
1919
td(th:text="${tsx.getBlockNumber()}")
2020
td
21-
button#select_tx_btn.button_main_dark Modify Info
21+
button._btn_modifyTX.button_main_dark Modify Info
2222
//- button.btn.btn-primary(type='button' data-toggle='modal' data-target='#exampleModal' data-whatever='@getbootstrap') Modify Transaction Info
2323
.container(style="display: flex; justify-content: center;")
2424
button#show_more_btn.button_main_dark.mb-4
25-
span.mr-2 Show More
26-
svg(width='12' height='9' viewbox='0 0 12 9' fill='none' xmlns='http://www.w3.org/2000/svg')
27-
path(d='M1.5 1L5.31502 6.70623C5.71971 7.31153 6.61494 7.29524 6.99733 6.67562L10.5 1' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round')
25+
#showMore.enabled(style="display: none;")
26+
span.mr-2 Show More
27+
svg(width='12' height='9' viewbox='0 0 12 9' fill='none' xmlns='http://www.w3.org/2000/svg')
28+
path(d='M1.5 1L5.31502 6.70623C5.71971 7.31153 6.61494 7.29524 6.99733 6.67562L10.5 1' stroke='white' stroke-width='2' stroke-linecap='round' stroke-linejoin='round')
29+
#showLess(style="display: none;")
30+
span.mr-2 Show Less
31+
svg(width='12' height='9' viewbox='0 0 12 9' fill='none' xmlns='http://www.w3.org/2000/svg')
32+
path(d="M10.5 8L6.68498 2.29377C6.28029 1.68847 5.38506 1.70476 5.00267 2.32438L1.5 8" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round")
33+
34+

0 commit comments

Comments
 (0)