Commit 2b8f40b 1 parent c3f4b7e commit 2b8f40b Copy full SHA for 2b8f40b
File tree 5 files changed +72
-38
lines changed
5 files changed +72
-38
lines changed Original file line number Diff line number Diff line change @@ -2,10 +2,11 @@ html, body {
2
2
position : relative;
3
3
width : 100% ;
4
4
height : 100% ;
5
+ background-color : # 2673b8 ;
5
6
}
6
7
7
8
body {
8
- color : # 333 ;
9
+ color : white ;
9
10
margin : 0 ;
10
11
padding : 8px ;
11
12
box-sizing : border-box;
Original file line number Diff line number Diff line change 32
32
}
33
33
34
34
const uploadToSC = async (e ) => {
35
+ console .log (callerAddress);
35
36
const ipfsHash = e .detail .path ;
36
37
// convert ipfsHash to bytes32 to fit the SC
37
38
const hashToSend = hashToBytes32 (ipfsHash);
89
90
}
90
91
91
92
function startApp () {
92
- etherGram = new web3.eth.Contract (ethergramABI,scAddress);
93
+ etherGram = new web3.eth.Contract (ethergramABI,scAddress);
93
94
}
94
95
95
96
window .addEventListener (' load' , async function () {
108
109
var accounts = await web3 .eth .getAccounts ();
109
110
callerAddress = accounts[0 ];
110
111
111
- var accountInterval = setInterval (function () {
112
- if (web3 .eth .accounts [0 ] !== callerAddress) {
113
- callerAddress = web3 .eth .accounts [0 ];
112
+ var accountInterval = setInterval (async function () {
113
+ let accounts = await web3 .eth .getAccounts ();
114
+ if (accounts[0 ] !== callerAddress) {
115
+ callerAddress = accounts[0 ];
114
116
}
115
117
}, 100 );
118
+
119
+ console .log (callerAddress);
116
120
})
117
121
118
122
119
123
</script >
120
124
121
125
<style >
122
126
h1 {
123
- color : rgb ( 59 , 70 , 168 ) ;
127
+ color : white ;
124
128
font-size : 80px ;
125
129
text-align : center ;
126
- background-color : azure
130
+ background-color : #31b3ca
127
131
}
128
132
</style >
129
133
130
- <h1 >Picture board DApp by Jason</h1 >
134
+
135
+ <h1 class =" title" >Picture board DApp by Jason</h1 >
131
136
132
137
133
138
{#if pages .postImage }
Original file line number Diff line number Diff line change 28
28
const reader = new FileReader ()
29
29
return new Promise ((resolve , reject ) => {
30
30
reader .onerror = () => {
31
- reader .abort ()
32
- reject (` problem reading file ${ file .name } ` )
31
+ reader .abort ()
32
+ reject (` problem reading file ${ file .name } ` )
33
33
}
34
34
reader .onload = () => {
35
- resolve (reader .result )
35
+ resolve (reader .result )
36
36
}
37
37
reader .readAsDataURL (file)
38
38
})
39
39
}
40
40
41
41
</script >
42
42
43
- <h2 >Upload your Images to Picture Board</h2 >
44
-
45
- <img src ={filePreview } alt =" filepreview" />
46
-
47
- <form on:submit ={onSubmit }>
48
- <input type ="file" on:change ={fileChange } />
49
- <input type =" submit" >
50
- </form >
51
-
52
- <input type ="submit" on:click ={() => dispatch (" viewImage" )} value =" View Picture Board" />
43
+ <h2 class =" subtitle" >Upload your Images to Picture Board</h2 >
44
+ <div class =" preview" >
45
+ <img src ={filePreview } alt =" filepreview" />
46
+ </div >
47
+
48
+ <div class =" upload-form" id =" upload-form" >
49
+ <form on:submit ={onSubmit }>
50
+ <input type ="file" on:change ={fileChange } />
51
+ <input type =" submit" >
52
+ </form >
53
+ </div >
54
+
55
+ <div class =" view-image-button" >
56
+ <input type ="submit" on:click ={() => dispatch (" viewImage" )} value =" View Picture Board" />
57
+ </div >
Original file line number Diff line number Diff line change 1
1
<style >
2
2
h1 {
3
- text-align : center ;
4
3
text-emphasis : 10 ;
5
4
}
5
+
6
+ .loader-container {
7
+ text-align : center ;
8
+ }
9
+
10
+ .loader {
11
+ display : inline-block ;
12
+ border-bottom : 16px solid #31b3ca ;
13
+ border-top : 16px solid white ; /* #2673b8*/
14
+ border-radius : 50% ;
15
+ width : 120px ;
16
+ height : 120px ;
17
+ animation : spin 2s linear infinite ;
18
+ }
19
+
20
+ @keyframes spin {
21
+ 0% { transform : rotate (0deg ); }
22
+ 100% { transform : rotate (360deg ); }
23
+ }
24
+
6
25
</style >
7
26
8
- <h1 >Please wait...</h1 >
27
+ <div class =" loader-container" >
28
+ <div class =" loader" ></div >
29
+ <h1 >Please wait...</h1 >
30
+ </div >
Original file line number Diff line number Diff line change 15
15
}
16
16
</script >
17
17
18
- <h2 >Picture Board</h2 >
18
+ <h2 class = " subtitle " >Picture Board</h2 >
19
19
20
20
<p >Double-click on image to give it a like. <br />
21
21
And, feel free to drop your comments and submit them.</p >
22
22
23
23
<input type ="submit" value ="Back" on:click ={() => dispatch (" back" )}/>
24
24
25
- <ul >
26
25
{#each postsFromSC as post }
27
- <li >
28
- <form on:dblclick ={clap } on:submit ={commentOnPost } name ={post .image }>
29
- <img src ="https://ipfs.infura.io/ipfs/ {post .image }" alt ={post .image }/>
30
- <input type =" text" placeholder =" Comment your thoughts about this image" maxlength =" 32" /> <input type =" submit" >
31
- </form >
32
- <p >{post .clapCounts } Like(s) </p >
33
- <p ><b >Comments ({post .comment .length })</b ></p >
34
- {#each post .comment as comment }
35
- <p >{comment } <br /> </p >
36
- {/each }
37
- </li >
38
- {/each }
39
- </ul >
26
+ <div class =" post-box" >
27
+ <form on:dblclick ={clap } on:submit ={commentOnPost } name ={post .image }>
28
+ <img src ="https://ipfs.infura.io/ipfs/ {post .image }" alt ={post .image }/>
29
+ <input type =" text" placeholder =" Comment your thoughts about this image" maxlength =" 32" /> <input type =" submit" >
30
+ </form >
31
+ <p >{post .clapCounts } Like(s) </p >
32
+
33
+ <div class =" comment-display" >
34
+ <p ><b >Comments ({post .comment .length })</b ></p >
35
+ {#each post .comment as comment }
36
+ <p >{comment } <br /> </p >
37
+ {/each }
38
+ </div >
39
+ </div >
40
+ {/each }
You can’t perform that action at this time.
0 commit comments