alpha
Login
or
Join now
atpota.to
/
cred.blue
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
This repository has no description
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Overview
Issues
Pulls
Pipelines
fix: restructure card imports
author
damedotblog
date
1 year ago
(Jan 21, 2025, 1:32 PM -0500)
commit
a42dc3dc
a42dc3dc3c56949bbd5bffeaace411dfae12a543
parent
f7a63a00
f7a63a00205b932544638de78892c332ceee9e1e
+135
-101
6 changed files
Expand all
Collapse all
Unified
Split
src
components
UserProfile
UserProfile.js
components
BadgesCard.js
PostMediaCard.js
PostTypeCard.js
ProfileCard.js
ScoreBreakdownCard.js
+113
-101
src/components/UserProfile/UserProfile.js
Reviewed
···
1
1
-
// src/components/UserProfile/UserProfile.jsx
2
1
import React, { useEffect, useState } from "react";
3
2
import { useParams } from "react-router-dom";
4
3
import { Responsive, WidthProvider } from "react-grid-layout";
5
4
import { loadAccountData } from "../../accountData"; // Ensure the path is correct
6
5
import Card from "../Card/Card";
7
6
import ProgressCircles from "../ProgressCircles"; // Import our updated progress visualization
7
7
+
8
8
+
// Import new card content components
9
9
+
import ActivityCard from "./components/ActivityCard";
10
10
+
import AltTextCard from "./components/AltTextCard";
11
11
+
import BadgesCard from "./components/BadgesCard";
12
12
+
import NarrativeCard from "./components/NarrativeCard";
13
13
+
import NeedleCard from "./components/NeedleCard";
14
14
+
import PostMediaCard from "./components/PostMediaCard";
15
15
+
import PostTypeCard from "./components/PostTypeCard";
16
16
+
import ProfileCard from "./components/ProfileCard";
17
17
+
import ScoreBreakdownCard from "./components/ScoreBreakdownCard";
18
18
+
import ScoresCard from "./components/ScoresCard";
19
19
+
8
20
import "./UserProfile.css";
9
21
import "react-grid-layout/css/styles.css"; // Import default grid-layout styles
10
22
import "react-resizable/css/styles.css";
···
27
39
useEffect(() => {
28
40
setLayouts({
29
41
lg: [
42
42
+
// Here you can order/position the cards as desired. The key "profilecard" corresponds to ProfileCard, etc.
30
43
{
31
31
-
i: "overview",
44
44
+
i: "profilecard",
32
45
x: 0,
33
46
y: 0,
34
47
w: 4,
···
39
52
maxH: 6,
40
53
},
41
54
{
42
42
-
i: "stats",
43
43
-
x: 6,
55
55
+
i: "activitycard",
56
56
+
x: 4,
44
57
y: 0,
45
58
w: 4,
46
59
h: 4,
···
50
63
maxH: 6,
51
64
},
52
65
{
53
53
-
i: "visualization1",
66
66
+
i: "alttextcard",
67
67
+
x: 8,
68
68
+
y: 0,
69
69
+
w: 4,
70
70
+
h: 4,
71
71
+
minW: 3,
72
72
+
maxW: 4,
73
73
+
minH: 3,
74
74
+
maxH: 6,
75
75
+
},
76
76
+
{
77
77
+
i: "badgescard",
54
78
x: 0,
55
79
y: 4,
56
80
w: 4,
···
61
85
maxH: 6,
62
86
},
63
87
{
64
64
-
i: "visualization2",
88
88
+
i: "narrativecard",
65
89
x: 4,
66
90
y: 4,
67
91
w: 4,
···
72
96
maxH: 6,
73
97
},
74
98
{
75
75
-
i: "recentActivity",
99
99
+
i: "needlecard",
76
100
x: 8,
77
101
y: 4,
78
102
w: 4,
79
103
h: 4,
80
104
minW: 3,
81
81
-
maxW: 6,
105
105
+
maxW: 4,
82
106
minH: 3,
83
107
maxH: 6,
84
108
},
85
109
{
86
86
-
i: "connections",
110
110
+
i: "postmediacard",
87
111
x: 0,
88
112
y: 8,
89
113
w: 4,
···
94
118
maxH: 6,
95
119
},
96
120
{
97
97
-
i: "settings",
121
121
+
i: "posttypecard",
98
122
x: 4,
99
123
y: 8,
100
124
w: 4,
···
105
129
maxH: 6,
106
130
},
107
131
{
108
108
-
i: "extra",
132
132
+
i: "scorebreakdowncard",
109
133
x: 8,
110
134
y: 8,
111
135
w: 4,
112
136
h: 4,
113
137
minW: 3,
114
114
-
maxW: 6,
138
138
+
maxW: 4,
115
139
minH: 3,
116
140
maxH: 6,
117
141
},
118
142
{
119
119
-
i: "additional",
143
143
+
i: "scorescard",
120
144
x: 0,
121
145
y: 12,
122
146
w: 4,
123
147
h: 4,
124
148
minW: 3,
125
125
-
maxW: 6,
149
149
+
maxW: 4,
126
150
minH: 3,
127
151
maxH: 6,
128
152
},
129
153
],
130
154
md: [
155
155
+
// You can define the md layout similarly if desired
131
156
{
132
132
-
i: "overview",
157
157
+
i: "profilecard",
133
158
x: 0,
134
159
y: 0,
135
160
w: 5,
···
140
165
maxH: 8,
141
166
},
142
167
{
143
143
-
i: "stats",
168
168
+
i: "activitycard",
144
169
x: 5,
145
170
y: 0,
146
171
w: 5,
···
151
176
maxH: 8,
152
177
},
153
178
{
154
154
-
i: "visualization1",
179
179
+
i: "alttextcard",
155
180
x: 0,
156
156
-
y: 4,
181
181
+
y: 7,
157
182
w: 5,
158
183
h: 7,
159
184
minW: 4,
···
162
187
maxH: 8,
163
188
},
164
189
{
165
165
-
i: "visualization2",
190
190
+
i: "badgescard",
166
191
x: 5,
167
167
-
y: 4,
192
192
+
y: 7,
168
193
w: 5,
169
194
h: 7,
170
195
minW: 4,
···
173
198
maxH: 8,
174
199
},
175
200
{
176
176
-
i: "recentActivity",
201
201
+
i: "narrativecard",
177
202
x: 0,
178
178
-
y: 8,
179
179
-
w: 10,
203
203
+
y: 14,
204
204
+
w: 5,
205
205
+
h: 7,
206
206
+
minW: 4,
207
207
+
maxW: 7,
208
208
+
minH: 4,
209
209
+
maxH: 8,
210
210
+
},
211
211
+
{
212
212
+
i: "needlecard",
213
213
+
x: 5,
214
214
+
y: 14,
215
215
+
w: 5,
180
216
h: 7,
181
181
-
minW: 8,
182
182
-
maxW: 10,
217
217
+
minW: 4,
218
218
+
maxW: 7,
183
219
minH: 4,
184
220
maxH: 8,
185
221
},
186
222
{
187
187
-
i: "connections",
223
223
+
i: "postmediacard",
188
224
x: 0,
189
189
-
y: 12,
225
225
+
y: 21,
190
226
w: 5,
191
227
h: 7,
192
228
minW: 4,
···
195
231
maxH: 8,
196
232
},
197
233
{
198
198
-
i: "settings",
234
234
+
i: "posttypecard",
199
235
x: 5,
200
200
-
y: 12,
236
236
+
y: 21,
201
237
w: 5,
202
238
h: 7,
203
239
minW: 4,
···
206
242
maxH: 8,
207
243
},
208
244
{
209
209
-
i: "extra",
245
245
+
i: "scorebreakdowncard",
210
246
x: 0,
211
211
-
y: 16,
247
247
+
y: 28,
212
248
w: 5,
213
249
h: 7,
214
250
minW: 4,
215
215
-
maxW: 7,
251
251
+
maxW: 5,
216
252
minH: 4,
217
253
maxH: 8,
218
254
},
219
255
{
220
220
-
i: "additional",
256
256
+
i: "scorescard",
221
257
x: 5,
222
222
-
y: 16,
258
258
+
y: 28,
223
259
w: 5,
224
260
h: 7,
225
261
minW: 4,
226
226
-
maxW: 7,
262
262
+
maxW: 5,
227
263
minH: 4,
228
264
maxH: 8,
229
265
},
···
238
274
};
239
275
240
276
// Fetch account data using our loadAccountData function.
241
241
-
// Each time an API page completes, our callback increments the circle count by 1.
242
277
useEffect(() => {
243
278
const fetchAccountData = async () => {
244
279
try {
···
260
295
fetchAccountData();
261
296
}, [username]);
262
297
263
263
-
// While loading, show our progress visualization which updates as each API call completes.
264
298
if (loading) {
265
299
return (
266
300
<div className="user-profile loading-container">
267
301
<ProgressCircles loading={loading} />
268
302
<p className="loading-text">
269
269
-
Loading account data... { /* display seconds elapsed as needed */ }
303
303
+
Loading account data... {/* display seconds elapsed as needed */}
270
304
</p>
271
305
</div>
272
306
);
···
280
314
return <div className="user-profile">No profile information available.</div>;
281
315
}
282
316
283
283
-
// Destructure some fields from accountData for display
317
317
+
// Destructure any fields you wish to pass as props from accountData
284
318
const {
285
319
profile,
286
320
displayName,
···
305
339
margin={[20, 20]}
306
340
onLayoutChange={handleLayoutChange}
307
341
>
308
308
-
<div key="overview" className="grid-item">
309
309
-
<Card title="Profile Overview">
310
310
-
<div className="drag-handle">
311
311
-
<span className="drag-icon">≡</span>
312
312
-
</div>
313
313
-
<p><strong>Username:</strong> {resolvedHandle}</p>
314
314
-
<p><strong>DID:</strong> {did}</p>
315
315
-
<p>
316
316
-
<strong>Account Created:</strong>{" "}
317
317
-
{new Date(createdAt).toLocaleDateString()}{" "}
318
318
-
(<em>{Math.floor(ageInDays)} days old</em>)
319
319
-
</p>
320
320
-
<p><strong>Service Endpoint:</strong> {serviceEndpoint}</p>
321
321
-
<p><strong>PDS Type:</strong> {pdsType}</p>
342
342
+
<div key="profilecard" className="grid-item">
343
343
+
<Card title="Profile">
344
344
+
<ProfileCard
345
345
+
resolvedHandle={resolvedHandle}
346
346
+
did={did}
347
347
+
createdAt={createdAt}
348
348
+
ageInDays={ageInDays}
349
349
+
serviceEndpoint={serviceEndpoint}
350
350
+
pdsType={pdsType}
351
351
+
/>
322
352
</Card>
323
353
</div>
324
354
325
325
-
<div key="stats" className="grid-item">
326
326
-
<Card title="Stats">
327
327
-
<div className="drag-handle">
328
328
-
<span className="drag-icon">≡</span>
329
329
-
</div>
330
330
-
<p>Stats details go here...</p>
355
355
+
<div key="activitycard" className="grid-item">
356
356
+
<Card title="Activity">
357
357
+
<ActivityCard profile={profile} />
358
358
+
</Card>
359
359
+
</div>
360
360
+
361
361
+
<div key="alttextcard" className="grid-item">
362
362
+
<Card title="Alt Text">
363
363
+
<AltTextCard profile={profile} />
331
364
</Card>
332
365
</div>
333
366
334
334
-
<div key="visualization1" className="grid-item">
335
335
-
<Card title="Visualization 1">
336
336
-
<div className="drag-handle">
337
337
-
<span className="drag-icon">≡</span>
338
338
-
</div>
339
339
-
<p>Chart or graph 1...</p>
367
367
+
<div key="badgescard" className="grid-item">
368
368
+
<Card title="Badges">
369
369
+
<BadgesCard profile={profile} />
340
370
</Card>
341
371
</div>
342
372
343
343
-
<div key="visualization2" className="grid-item">
344
344
-
<Card title="Visualization 2">
345
345
-
<div className="drag-handle">
346
346
-
<span className="drag-icon">≡</span>
347
347
-
</div>
348
348
-
<p>Chart or graph 2...</p>
373
373
+
<div key="narrativecard" className="grid-item">
374
374
+
<Card title="Narrative">
375
375
+
<NarrativeCard profile={profile} />
349
376
</Card>
350
377
</div>
351
378
352
352
-
<div key="recentActivity" className="grid-item">
353
353
-
<Card title="Recent Activity">
354
354
-
<div className="drag-handle">
355
355
-
<span className="drag-icon">≡</span>
356
356
-
</div>
357
357
-
<p>Recent user activities...</p>
379
379
+
<div key="needlecard" className="grid-item">
380
380
+
<Card title="Needle">
381
381
+
<NeedleCard profile={profile} />
358
382
</Card>
359
383
</div>
360
384
361
361
-
<div key="connections" className="grid-item">
362
362
-
<Card title="Connections">
363
363
-
<div className="drag-handle">
364
364
-
<span className="drag-icon">≡</span>
365
365
-
</div>
366
366
-
<p>Follower or connection info...</p>
385
385
+
<div key="postmediacard" className="grid-item">
386
386
+
<Card title="Post Media">
387
387
+
<PostMediaCard profile={profile} />
367
388
</Card>
368
389
</div>
369
390
370
370
-
<div key="settings" className="grid-item">
371
371
-
<Card title="Settings">
372
372
-
<div className="drag-handle">
373
373
-
<span className="drag-icon">≡</span>
374
374
-
</div>
375
375
-
<p>Settings details...</p>
391
391
+
<div key="posttypecard" className="grid-item">
392
392
+
<Card title="Post Type">
393
393
+
<PostTypeCard profile={profile} />
376
394
</Card>
377
395
</div>
378
396
379
379
-
<div key="extra" className="grid-item">
380
380
-
<Card title="Extra">
381
381
-
<div className="drag-handle">
382
382
-
<span className="drag-icon">≡</span>
383
383
-
</div>
384
384
-
<p>Extra details...</p>
397
397
+
<div key="scorebreakdowncard" className="grid-item">
398
398
+
<Card title="Score Breakdown">
399
399
+
<ScoreBreakdownCard profile={profile} />
385
400
</Card>
386
401
</div>
387
402
388
388
-
<div key="additional" className="grid-item">
389
389
-
<Card title="Additional Info">
390
390
-
<div className="drag-handle">
391
391
-
<span className="drag-icon">≡</span>
392
392
-
</div>
393
393
-
<p>Additional information...</p>
403
403
+
<div key="scorescard" className="grid-item">
404
404
+
<Card title="Scores">
405
405
+
<ScoresCard profile={profile} />
394
406
</Card>
395
407
</div>
396
408
</ResponsiveGridLayout>
src/components/UserProfile/components/Badges.js
src/components/UserProfile/components/BadgesCard.js
Reviewed
src/components/UserProfile/components/PostMediaViz.js
src/components/UserProfile/components/PostMediaCard.js
Reviewed
src/components/UserProfile/components/PostTypeViz.js
src/components/UserProfile/components/PostTypeCard.js
Reviewed
+22
src/components/UserProfile/components/ProfileCard.js
Reviewed
···
1
1
+
import React from "react";
2
2
+
3
3
+
const ProfileCard = ({ resolvedHandle, did, createdAt, ageInDays, serviceEndpoint, pdsType }) => {
4
4
+
return (
5
5
+
<div>
6
6
+
<div className="drag-handle">
7
7
+
<span className="drag-icon">≡</span>
8
8
+
</div>
9
9
+
<p><strong>Username:</strong> {resolvedHandle}</p>
10
10
+
<p><strong>DID:</strong> {did}</p>
11
11
+
<p>
12
12
+
<strong>Account Created:</strong>{" "}
13
13
+
{new Date(createdAt).toLocaleDateString()}{" "}
14
14
+
(<em>{Math.floor(ageInDays)} days old</em>)
15
15
+
</p>
16
16
+
<p><strong>Service Endpoint:</strong> {serviceEndpoint}</p>
17
17
+
<p><strong>PDS Type:</strong> {pdsType}</p>
18
18
+
</div>
19
19
+
);
20
20
+
};
21
21
+
22
22
+
export default ProfileCard;
src/components/UserProfile/components/ScoreBreakdownViz.js
src/components/UserProfile/components/ScoreBreakdownCard.js
Reviewed