pwa-auth 2.0.4 → 2.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -1
- package/README.md +61 -37
- package/demo/css/pwa-styles.css +77 -0
- package/demo/images/empty.jpg +0 -0
- package/demo/index.html +26 -130
- package/deploy/css/font.d.ts.map +1 -1
- package/deploy/css/form/button.d.ts.map +1 -1
- package/deploy/css/form/input.d.ts.map +1 -1
- package/deploy/css/form/label.d.ts.map +1 -1
- package/deploy/css/form/list.d.ts.map +1 -1
- package/deploy/css/svg.d.ts.map +1 -1
- package/deploy/css/toggle.d.ts.map +1 -1
- package/deploy/custom-elements/drawer/css/drawer.d.ts.map +1 -1
- package/deploy/custom-elements/drawer/css/exit.d.ts.map +1 -1
- package/deploy/custom-elements/drawer/css/link.d.ts.map +1 -1
- package/deploy/custom-elements/drawer/css/paragraph.d.ts.map +1 -1
- package/deploy/custom-elements/drawer/css/toggle.d.ts.map +1 -1
- package/deploy/custom-elements/drawer/drawer.d.ts.map +1 -1
- package/deploy/custom-elements/drawer/drawer.js +1 -1
- package/deploy/custom-elements/drawer/input/forgot.d.ts.map +1 -1
- package/deploy/custom-elements/drawer/input/forgot.js +1 -1
- package/deploy/custom-elements/drawer/input/login.d.ts.map +1 -1
- package/deploy/custom-elements/drawer/input/login.js +1 -1
- package/deploy/custom-elements/drawer/input/sign-up.d.ts.map +1 -1
- package/deploy/custom-elements/drawer/input/sign-up.js +1 -1
- package/deploy/custom-elements/icon/css/icon.d.ts.map +1 -1
- package/deploy/custom-elements/icon/css/icon.js +0 -1
- package/deploy/custom-elements/icon/icon.d.ts +1 -0
- package/deploy/custom-elements/icon/icon.d.ts.map +1 -1
- package/deploy/custom-elements/icon/icon.js +5 -1
- package/deploy/custom-elements/settings/css/navigation.d.ts.map +1 -1
- package/deploy/custom-elements/settings/input/delete.d.ts.map +1 -1
- package/deploy/custom-elements/settings/input/delete.js +1 -1
- package/deploy/custom-elements/settings/input/email.d.ts.map +1 -1
- package/deploy/custom-elements/settings/input/email.js +1 -1
- package/deploy/custom-elements/settings/input/images.d.ts.map +1 -1
- package/deploy/custom-elements/settings/input/images.js +1 -1
- package/deploy/custom-elements/settings/input/name.d.ts.map +1 -1
- package/deploy/custom-elements/settings/input/name.js +1 -1
- package/deploy/custom-elements/settings/input/password.d.ts.map +1 -1
- package/deploy/custom-elements/settings/input/password.js +1 -1
- package/deploy/custom-elements/settings/input/uploader.d.ts +1 -2
- package/deploy/custom-elements/settings/input/uploader.d.ts.map +1 -1
- package/deploy/custom-elements/settings/input/uploader.js +16 -23
- package/deploy/custom-elements/settings/settings.d.ts +1 -0
- package/deploy/custom-elements/settings/settings.d.ts.map +1 -1
- package/deploy/custom-elements/settings/settings.js +6 -2
- package/deploy/firebase/firebase-login.d.ts +21 -0
- package/deploy/firebase/firebase-login.d.ts.map +1 -0
- package/deploy/firebase/firebase-login.js +85 -0
- package/deploy/firebase/firebase.d.ts +20 -0
- package/deploy/firebase/firebase.d.ts.map +1 -0
- package/deploy/firebase/firebase.js +76 -0
- package/deploy/firebase/start.d.ts.map +1 -0
- package/deploy/{start.js → firebase/start.js} +11 -10
- package/deploy/lazy-loader.d.ts.map +1 -1
- package/deploy/redux/backend.d.ts.map +1 -1
- package/deploy/redux/drawer.d.ts.map +1 -1
- package/deploy/redux/frontend.d.ts.map +1 -1
- package/deploy/redux/frontend.js +1 -1
- package/deploy/redux/object.d.ts.map +1 -1
- package/deploy/store.d.ts.map +1 -1
- package/npm/images/empty.jpg +0 -0
- package/npm/pwa-auth.js +1 -1
- package/package.json +4 -3
- package/source/css/font.ts +17 -0
- package/source/css/form/button.ts +55 -0
- package/source/css/form/input.ts +25 -0
- package/source/css/form/label.ts +25 -0
- package/source/css/form/list.ts +23 -0
- package/source/css/svg.ts +5 -0
- package/source/css/toggle.ts +9 -0
- package/source/custom-elements/drawer/css/drawer.ts +64 -0
- package/source/custom-elements/drawer/css/exit.ts +49 -0
- package/source/custom-elements/drawer/css/link.ts +15 -0
- package/source/custom-elements/drawer/css/paragraph.ts +11 -0
- package/source/custom-elements/drawer/css/toggle.ts +19 -0
- package/source/custom-elements/drawer/drawer.ts +120 -0
- package/source/custom-elements/drawer/input/forgot.ts +121 -0
- package/source/custom-elements/drawer/input/login.ts +135 -0
- package/source/custom-elements/drawer/input/sign-up.ts +158 -0
- package/source/custom-elements/icon/css/icon.ts +70 -0
- package/source/custom-elements/icon/icon.ts +90 -0
- package/source/custom-elements/settings/css/navigation.ts +92 -0
- package/source/custom-elements/settings/input/delete.ts +83 -0
- package/source/custom-elements/settings/input/email.ts +135 -0
- package/source/custom-elements/settings/input/images.ts +57 -0
- package/source/custom-elements/settings/input/name.ts +99 -0
- package/source/custom-elements/settings/input/password.ts +156 -0
- package/source/custom-elements/settings/input/uploader.ts +329 -0
- package/source/custom-elements/settings/settings.ts +205 -0
- package/source/firebase/firebase-login.ts +246 -0
- package/source/firebase/firebase.ts +214 -0
- package/source/firebase/start.ts +216 -0
- package/source/lazy-loader.ts +20 -0
- package/source/redux/backend.ts +94 -0
- package/source/redux/drawer.ts +37 -0
- package/source/redux/frontend.ts +134 -0
- package/source/redux/object.ts +31 -0
- package/source/store.ts +19 -0
- package/website/404.html +33 -0
- package/website/THIRD_PARTY_LICENSES.txt +303 -0
- package/website/css/pwa-styles.css +36 -0
- package/website/css/styles.css +67 -0
- package/website/images/empty.jpg +0 -0
- package/website/images/favicon.ico +0 -0
- package/website/images/manifest/logo-144.png +0 -0
- package/website/images/manifest/logo-192.png +0 -0
- package/website/images/manifest/logo-48.png +0 -0
- package/website/images/manifest/logo-512.png +0 -0
- package/website/images/manifest/logo-72.png +0 -0
- package/website/images/manifest/logo-96.png +0 -0
- package/website/images/manifest/maskable_icon_x128.png +0 -0
- package/website/images/manifest/maskable_icon_x192.png +0 -0
- package/website/images/manifest/maskable_icon_x384.png +0 -0
- package/website/images/manifest/maskable_icon_x48.png +0 -0
- package/website/images/manifest/maskable_icon_x512.png +0 -0
- package/website/images/manifest/maskable_icon_x72.png +0 -0
- package/website/images/manifest/maskable_icon_x96.png +0 -0
- package/website/index.html +64 -0
- package/website/js/pwa-auth.js +306 -0
- package/website/sitemap.xml +11 -0
- package/deploy/interface.d.ts +0 -37
- package/deploy/interface.d.ts.map +0 -1
- package/deploy/interface.js +0 -176
- package/deploy/start.d.ts.map +0 -1
- /package/demo/{styles.css → css/styles.css} +0 -0
- /package/deploy/{start.d.ts → firebase/start.d.ts} +0 -0
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
|
|
2
|
+
import { html, css, LitElement, CSSResultArray } from 'lit';
|
|
3
|
+
import { property, state } from 'lit/decorators.js';
|
|
4
|
+
import { store, AppState } from '../../../store';
|
|
5
|
+
import { connect } from 'pwa-helpers';
|
|
6
|
+
import { auth, storage, user } from '../../../firebase/start';
|
|
7
|
+
import { updateProfile } from 'firebase/auth';
|
|
8
|
+
import { accImage } from '../../../redux/backend';
|
|
9
|
+
import { ref, updateMetadata, getDownloadURL, uploadBytesResumable } from "@firebase/storage";
|
|
10
|
+
import { labelStyle } from '../../../css/form/label';
|
|
11
|
+
|
|
12
|
+
export class ContactPhoto extends connect(store)(LitElement) {
|
|
13
|
+
|
|
14
|
+
/** @attr photo */
|
|
15
|
+
@property() public photo : string | void | any = '';
|
|
16
|
+
|
|
17
|
+
/** @attr emptyArtwork */
|
|
18
|
+
@property({type: String, reflect: true}) public emptyArtwork = '';
|
|
19
|
+
|
|
20
|
+
@state() private user : string | void = '';
|
|
21
|
+
@state() private login : boolean = false;
|
|
22
|
+
//@state() private uploadProgress = 0;
|
|
23
|
+
//@state() private uploadComplete = false;
|
|
24
|
+
|
|
25
|
+
@state() private progress: number = 0;
|
|
26
|
+
// @state() private downloadURL: string = '';
|
|
27
|
+
@state() private error: string = '';
|
|
28
|
+
@state() private status: string = '';
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
constructor() {
|
|
32
|
+
super();
|
|
33
|
+
this.progress = 0;
|
|
34
|
+
// this.downloadURL = '';
|
|
35
|
+
this.error = '';
|
|
36
|
+
this.status = '';
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
stateChanged(state: AppState) {
|
|
40
|
+
this.login = state.frontend!.login;
|
|
41
|
+
this.user = state.backend!.userId;
|
|
42
|
+
this.photo = state.backend!.photoURL;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// protected firstUpdated(_changedProperties: PropertyValueMap<any> | Map<PropertyKey, unknown>): void {
|
|
46
|
+
|
|
47
|
+
// }
|
|
48
|
+
|
|
49
|
+
static get styles():CSSResultArray {
|
|
50
|
+
return[
|
|
51
|
+
labelStyle,
|
|
52
|
+
css`
|
|
53
|
+
|
|
54
|
+
:host {
|
|
55
|
+
box-sizing: border-box;
|
|
56
|
+
-webkit-box-sizing: border-box;
|
|
57
|
+
display: grid;
|
|
58
|
+
grid-template-columns: 1fr;
|
|
59
|
+
grid-gap: 4px;
|
|
60
|
+
width: 100%;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
input[type=file] {
|
|
64
|
+
border-radius: 50%;
|
|
65
|
+
overflow: hidden;
|
|
66
|
+
margin: auto;
|
|
67
|
+
border: 2px solid #303030;
|
|
68
|
+
box-shadow: 1px 1px 2px black, 0 0 25px grey, 0 0 5px #fff;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
`
|
|
72
|
+
]
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
protected render() {
|
|
76
|
+
return html`
|
|
77
|
+
<label
|
|
78
|
+
for="pwa-uploader"
|
|
79
|
+
style="
|
|
80
|
+
grid-template-columns: auto 1fr;
|
|
81
|
+
grid-gap:16px;
|
|
82
|
+
padding: 0 16px;
|
|
83
|
+
">Upload:
|
|
84
|
+
<progress
|
|
85
|
+
id ="pwa-uploader"
|
|
86
|
+
class ="uploader"
|
|
87
|
+
value ="0"
|
|
88
|
+
max ="100"
|
|
89
|
+
style="
|
|
90
|
+
height: 24px;
|
|
91
|
+
width: 100%;
|
|
92
|
+
margin: auto;
|
|
93
|
+
"></label>
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
<!-- Input - Upload Image -->
|
|
98
|
+
<input
|
|
99
|
+
id ="photoURL"
|
|
100
|
+
type ="file"
|
|
101
|
+
name ="photoURL"
|
|
102
|
+
class ="contractorPhoto"
|
|
103
|
+
accept ="image/*"
|
|
104
|
+
@change ="${this.saveImage}"
|
|
105
|
+
?disabled="${this.login === false}"
|
|
106
|
+
style ="
|
|
107
|
+
display: none;
|
|
108
|
+
cursor: pointer;
|
|
109
|
+
position: absolute;
|
|
110
|
+
z-index: -1;
|
|
111
|
+
"/></progress>
|
|
112
|
+
|
|
113
|
+
<label
|
|
114
|
+
style="
|
|
115
|
+
border: 2px dashed;
|
|
116
|
+
border-radius: 6px;
|
|
117
|
+
overflow: hidden;
|
|
118
|
+
padding: 0 16px 16px 16px;
|
|
119
|
+
"
|
|
120
|
+
for ="photoURL">Photo:
|
|
121
|
+
|
|
122
|
+
<!-- Output - Retrieved Image -->
|
|
123
|
+
<canvas
|
|
124
|
+
style="
|
|
125
|
+
margin: auto;
|
|
126
|
+
height: 200px;
|
|
127
|
+
width: 100%;
|
|
128
|
+
background-image: url(${this.photo ? this.photo : this.emptyArtwork});
|
|
129
|
+
background-size: contain;
|
|
130
|
+
background-repeat: no-repeat;
|
|
131
|
+
background-position: center;
|
|
132
|
+
cursor: pointer;
|
|
133
|
+
overflow: hidden;
|
|
134
|
+
box-sizing: border-box;
|
|
135
|
+
">
|
|
136
|
+
</canvas>
|
|
137
|
+
|
|
138
|
+
</label>
|
|
139
|
+
|
|
140
|
+
<p style="text-align:center;">${this.status}${this.error}</p>
|
|
141
|
+
`;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
/*
|
|
149
|
+
|
|
150
|
+
private appendToFileLocation(filePath: string, appendString: string): string {
|
|
151
|
+
|
|
152
|
+
const lastDotIndex = filePath.lastIndexOf('.'); // Find the last dot to get the file extension
|
|
153
|
+
|
|
154
|
+
if (lastDotIndex <= 0) return filePath; // If there's no dot or it's at the beginning, don't alter the filePath
|
|
155
|
+
|
|
156
|
+
const basePath = filePath.substring(0, lastDotIndex); // Slice the filePath into the base path and extension
|
|
157
|
+
const extension = filePath.substring(lastDotIndex); // Includes the dot
|
|
158
|
+
|
|
159
|
+
// console.log('path: ', basePath, appendString, extension);
|
|
160
|
+
|
|
161
|
+
return `${basePath}${appendString}${extension}`; // Append the string and add the extension back
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
*/
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
// Save Image to Storage and Database - Update Profile Photo URL in Database and State
|
|
168
|
+
private async saveImage() {
|
|
169
|
+
|
|
170
|
+
// Select Progress Bar
|
|
171
|
+
const uploader: HTMLProgressElement = this.shadowRoot!.querySelector('.uploader')!;
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
if(auth.currentUser){
|
|
175
|
+
|
|
176
|
+
this.error = '';
|
|
177
|
+
this.status = 'Uploading...';
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
// Select: File
|
|
181
|
+
const file : any = this.shadowRoot!.querySelector('#photoURL');
|
|
182
|
+
|
|
183
|
+
// If File Empty
|
|
184
|
+
if (!file) {
|
|
185
|
+
console.error('No file selected');
|
|
186
|
+
return;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
// Test Storage Reference location.fullPath location.name location.bucket
|
|
190
|
+
const location = ref(storage,
|
|
191
|
+
"/" +
|
|
192
|
+
"pwa-auth" +
|
|
193
|
+
"/" +
|
|
194
|
+
this.user +
|
|
195
|
+
"/" +
|
|
196
|
+
file.files[0].name );
|
|
197
|
+
|
|
198
|
+
// const uploadTask = uploadBytesResumable(location, file);
|
|
199
|
+
|
|
200
|
+
// Create metadata from file information
|
|
201
|
+
const newMetadata = {
|
|
202
|
+
cacheControl: 'public,max-age=300',
|
|
203
|
+
contentType: file.files[0].type // 'image/jpeg'
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
|
|
210
|
+
// Upload - Blob or File API
|
|
211
|
+
const uploadTask = uploadBytesResumable (location, file.files[0], newMetadata);// .then((snapshot:any) => {
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
// Monitor upload progress
|
|
218
|
+
uploadTask.on(
|
|
219
|
+
'state_changed',
|
|
220
|
+
(snapshot) => {
|
|
221
|
+
// Calculate progress percentage safely
|
|
222
|
+
this.progress = (snapshot.bytesTransferred / snapshot.totalBytes) * 100;
|
|
223
|
+
this.status = `Upload is ${Math.round(this.progress)}% done`;
|
|
224
|
+
switch (snapshot.state) {
|
|
225
|
+
case 'paused':
|
|
226
|
+
this.status = 'Upload is paused';
|
|
227
|
+
break;
|
|
228
|
+
case 'running':
|
|
229
|
+
this.status = `Upload is running (${Math.round(this.progress)}%)`;
|
|
230
|
+
break;
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
let progress = 0;
|
|
234
|
+
if (snapshot.totalBytes > 0) {
|
|
235
|
+
progress = (snapshot.bytesTransferred / snapshot.totalBytes) * 100;
|
|
236
|
+
}
|
|
237
|
+
// Ensure progress is finite before setting
|
|
238
|
+
if (isFinite(progress)) {
|
|
239
|
+
uploader.value = progress;
|
|
240
|
+
uploader.textContent = `${Math.round(progress)}%`;
|
|
241
|
+
} else {
|
|
242
|
+
uploader.value = 0;
|
|
243
|
+
uploader.textContent = '0%';
|
|
244
|
+
}
|
|
245
|
+
},
|
|
246
|
+
(error) => {
|
|
247
|
+
// Handle errors
|
|
248
|
+
this.error = `Upload failed: ${error.message}`;
|
|
249
|
+
this.status = '';
|
|
250
|
+
|
|
251
|
+
console.error('Upload failed:', error);
|
|
252
|
+
uploader.value = 0;
|
|
253
|
+
uploader.textContent = 'Error';
|
|
254
|
+
// uploadButton.disabled = false;
|
|
255
|
+
},
|
|
256
|
+
async () => {
|
|
257
|
+
// Upload completed successfully
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
// Get URL
|
|
262
|
+
await getDownloadURL(uploadTask.snapshot.ref)
|
|
263
|
+
.then( (url:any) => {
|
|
264
|
+
|
|
265
|
+
// Update metadata properties
|
|
266
|
+
updateMetadata(location, newMetadata)
|
|
267
|
+
.then((/*metadata:any*/) => { /* console.log("metadata: ", metadata); */ }).catch((error:any) => { console.log("error: ", error); });
|
|
268
|
+
|
|
269
|
+
// To Do: Save Minified Photo - Service
|
|
270
|
+
// const modifiedFilePath = this.appendToFileLocation(url, '_400x400');
|
|
271
|
+
// console.log('modifiedFilePath', modifiedFilePath);
|
|
272
|
+
|
|
273
|
+
if (user) {
|
|
274
|
+
|
|
275
|
+
updateProfile(user, { photoURL: url })
|
|
276
|
+
.then(() => {
|
|
277
|
+
// console.log('Profile picture updated successfully');
|
|
278
|
+
uploader.value = 100;
|
|
279
|
+
uploader.textContent = 'Complete';
|
|
280
|
+
});
|
|
281
|
+
|
|
282
|
+
this.status = 'User profile updated successfully!';
|
|
283
|
+
|
|
284
|
+
// const resizedLocation = ref(storage, 'images/article/' + file.name + '_400x400' ); // Path where the image will be stored in Firebase Storage
|
|
285
|
+
|
|
286
|
+
// Save URL
|
|
287
|
+
this.dispatchPhoto(url);
|
|
288
|
+
|
|
289
|
+
} // End If Statement
|
|
290
|
+
|
|
291
|
+
}).catch( () => {} );
|
|
292
|
+
|
|
293
|
+
// }).catch( () => {} );
|
|
294
|
+
|
|
295
|
+
});
|
|
296
|
+
|
|
297
|
+
|
|
298
|
+
|
|
299
|
+
} // End - if (auth.currentUser) {}
|
|
300
|
+
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
}
|
|
304
|
+
|
|
305
|
+
// UPDATE - PROFILE + Firestore Database + STATE - SAVE FILE LOCATION
|
|
306
|
+
private dispatchPhoto = async (url:string) => {
|
|
307
|
+
|
|
308
|
+
if ( auth.currentUser ) {
|
|
309
|
+
|
|
310
|
+
// Update Profile Photo URL in Database - Firestore
|
|
311
|
+
await updateProfile( auth.currentUser, { photoURL: url }).catch((error:Error) => { console.log(error); });
|
|
312
|
+
|
|
313
|
+
// Update Profile Photo URL in State - Redux
|
|
314
|
+
store.dispatch( accImage(url) );
|
|
315
|
+
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
customElements.define('contact-photo', ContactPhoto);
|
|
323
|
+
|
|
324
|
+
declare global {
|
|
325
|
+
interface HTMLElementTagNameMap {
|
|
326
|
+
'contact-photo': ContactPhoto;
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { css, html, LitElement } from 'lit';
|
|
2
|
+
import { state, customElement, property } from 'lit/decorators.js';
|
|
3
|
+
import { connect } from 'pwa-helpers/connect-mixin.js';
|
|
4
|
+
import { store, AppState } from '../../store';
|
|
5
|
+
import { navigateAuth } from '../../redux/frontend';
|
|
6
|
+
import { navigation } from './css/navigation';
|
|
7
|
+
import './input/uploader';
|
|
8
|
+
import './input/name';
|
|
9
|
+
import './input/email';
|
|
10
|
+
import './input/password';
|
|
11
|
+
import './input/delete';
|
|
12
|
+
import { listStyle } from '../../css/form/list';
|
|
13
|
+
|
|
14
|
+
@customElement('user-settings')
|
|
15
|
+
export class UserSettings extends connect(store)(LitElement) {
|
|
16
|
+
|
|
17
|
+
/** @attr emptyArtwork */
|
|
18
|
+
@property({type: String, reflect: true}) public emptyArtwork = '';
|
|
19
|
+
|
|
20
|
+
@state() private profileTopic = '';
|
|
21
|
+
@state() private name = '';
|
|
22
|
+
|
|
23
|
+
constructor() { super(); }
|
|
24
|
+
|
|
25
|
+
protected firstUpdated() {
|
|
26
|
+
|
|
27
|
+
/* Form Default */
|
|
28
|
+
const forms = this.querySelectorAll('form')!
|
|
29
|
+
forms.forEach( item => {
|
|
30
|
+
item.preventDefault();
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
/* 1 */
|
|
34
|
+
this.shadowRoot!.querySelector('button[value=profile]')!.addEventListener('click', () => {
|
|
35
|
+
store.dispatch(navigateAuth('profile'));
|
|
36
|
+
} );
|
|
37
|
+
|
|
38
|
+
/* 2 */
|
|
39
|
+
this.shadowRoot!.querySelector('button[value=verification]')!.addEventListener('click', () => {
|
|
40
|
+
store.dispatch(navigateAuth('verification'));
|
|
41
|
+
} );
|
|
42
|
+
|
|
43
|
+
/* 3 */
|
|
44
|
+
this.shadowRoot!.querySelector('button[value=password]')!.addEventListener('click', () => {
|
|
45
|
+
store.dispatch(navigateAuth('password'));
|
|
46
|
+
} );
|
|
47
|
+
|
|
48
|
+
/* 4 */
|
|
49
|
+
this.shadowRoot!.querySelector('button[value=delete]')!.addEventListener('click', () => {
|
|
50
|
+
store.dispatch(navigateAuth('delete'));
|
|
51
|
+
} );
|
|
52
|
+
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
stateChanged(state: AppState) {
|
|
56
|
+
this.profileTopic = state.frontend!.settings; // Page String
|
|
57
|
+
this.name = state.backend!.name; // Username
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
static get styles() { return [
|
|
61
|
+
navigation,
|
|
62
|
+
listStyle,
|
|
63
|
+
css`
|
|
64
|
+
|
|
65
|
+
/* Button Padding for Border Outline */
|
|
66
|
+
:host {
|
|
67
|
+
display: grid;
|
|
68
|
+
background-color: var(--pwa_settings_background);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/* Page Form */
|
|
72
|
+
form {
|
|
73
|
+
box-sizing: border-box;
|
|
74
|
+
display: grid;
|
|
75
|
+
border: 0;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/* Page Title */
|
|
79
|
+
.pageTitle { margin: 0; }
|
|
80
|
+
|
|
81
|
+
h2 {
|
|
82
|
+
color: var(--pwa_section_header);
|
|
83
|
+
text-align: center;
|
|
84
|
+
text-shadow: 1px 1px 2px black, 0 0 15px grey, 0 0 5px #fff;
|
|
85
|
+
|
|
86
|
+
border-top: 2px solid var(--pwa_divider);
|
|
87
|
+
border-bottom: 2px solid var(--pwa_divider);
|
|
88
|
+
|
|
89
|
+
margin: 0;
|
|
90
|
+
padding: 8px 0;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
/* up to 576 pixels */
|
|
94
|
+
@media only screen and (max-width: 576px) {
|
|
95
|
+
h2 {
|
|
96
|
+
font-size: medium;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
`
|
|
101
|
+
]; }
|
|
102
|
+
|
|
103
|
+
protected render() {
|
|
104
|
+
return html`
|
|
105
|
+
|
|
106
|
+
<!-- Page Menu -->
|
|
107
|
+
<nav>
|
|
108
|
+
|
|
109
|
+
<ul>
|
|
110
|
+
|
|
111
|
+
<li>
|
|
112
|
+
<button
|
|
113
|
+
value="profile"
|
|
114
|
+
?on="${ this.profileTopic === 'profile'}">Icon
|
|
115
|
+
</button>
|
|
116
|
+
</li>
|
|
117
|
+
|
|
118
|
+
<li>
|
|
119
|
+
<button
|
|
120
|
+
value="verification"
|
|
121
|
+
?on="${ this.profileTopic === 'verification'}">Profile
|
|
122
|
+
</button>
|
|
123
|
+
</li>
|
|
124
|
+
|
|
125
|
+
<li>
|
|
126
|
+
<button
|
|
127
|
+
value="password"
|
|
128
|
+
?on="${ this.profileTopic === 'password'}">Password
|
|
129
|
+
</button>
|
|
130
|
+
</li>
|
|
131
|
+
|
|
132
|
+
<li>
|
|
133
|
+
<button
|
|
134
|
+
value="delete"
|
|
135
|
+
?on="${ this.profileTopic === 'delete'}">Delete
|
|
136
|
+
</button>
|
|
137
|
+
</li>
|
|
138
|
+
|
|
139
|
+
</ul>
|
|
140
|
+
|
|
141
|
+
</nav>
|
|
142
|
+
|
|
143
|
+
<!-- Page 1: Profile -->
|
|
144
|
+
<section ?on="${ this.profileTopic === 'profile' }">
|
|
145
|
+
|
|
146
|
+
<!-- Display Username -->
|
|
147
|
+
<h2>${this.name}</h2>
|
|
148
|
+
|
|
149
|
+
<!-- Custom Image Element - Display / Upload -->
|
|
150
|
+
<contact-photo emptyArtwork="${this.emptyArtwork}"></contact-photo>
|
|
151
|
+
|
|
152
|
+
</section>
|
|
153
|
+
|
|
154
|
+
<!-- Page 2: Verification -->
|
|
155
|
+
<section ?on="${ this.profileTopic === 'verification' }">
|
|
156
|
+
|
|
157
|
+
<!-- Page Title -->
|
|
158
|
+
<h2>Contact Information</h2>
|
|
159
|
+
|
|
160
|
+
<!-- Custom - Username -->
|
|
161
|
+
<input-name></input-name>
|
|
162
|
+
|
|
163
|
+
<!-- Custom - Email -->
|
|
164
|
+
<contact-email></contact-email>
|
|
165
|
+
|
|
166
|
+
<!-- Indicator - Verified -->
|
|
167
|
+
<div class="verified"></div>
|
|
168
|
+
|
|
169
|
+
</section>
|
|
170
|
+
|
|
171
|
+
<!-- Page 3: Password -->
|
|
172
|
+
<section ?on="${ this.profileTopic === 'password' }">
|
|
173
|
+
|
|
174
|
+
<!-- Page Title -->
|
|
175
|
+
<h2>Password</h2>
|
|
176
|
+
|
|
177
|
+
<!-- Custom - Password -->
|
|
178
|
+
<input-password></input-password>
|
|
179
|
+
|
|
180
|
+
</section>
|
|
181
|
+
|
|
182
|
+
<!-- Page 4: Delete -->
|
|
183
|
+
<section ?on="${ this.profileTopic === 'delete' }">
|
|
184
|
+
|
|
185
|
+
<!-- Page Title -->
|
|
186
|
+
<h2>Delete Account</h2>
|
|
187
|
+
|
|
188
|
+
<!-- Custom - Delete -->
|
|
189
|
+
<delete-user></delete-user>
|
|
190
|
+
|
|
191
|
+
</section>
|
|
192
|
+
|
|
193
|
+
`
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
declare global {
|
|
199
|
+
interface HTMLElementTagNameMap {
|
|
200
|
+
'user-settings': UserSettings;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
|