-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathpage.js
112 lines (105 loc) · 4.26 KB
/
page.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/**
* Copyright 2024 OpenBuild
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
'use client';
import { useEffect, useState } from 'react';
import { OViewer } from '@/components/MarkDown';
import { Skeleton } from '@/components/Skeleton/details';
import { fromNow } from '@/utils/date';
import SkillOverviewView from '#/domain/skill/views/skill-overview';
import SkillLabel from '#/domain/skill/widgets/skill-label';
import { ownedNFTs } from '#/services/common';
import { useDetails } from '#/services/shilling/hooks';
import { Author } from './Author';
import { Header } from './Header';
export default function Page({ params }) {
const { data, loading } = useDetails(params.id);
const [nfts, setNfts] = useState([]);
useEffect(() => {
if (data?.onchain_show) {
ownedNFTs(data.onchain_address).then(res => {
if (res.code === 200) {
setNfts(res.data.list || []);
}
});
}
}, [data]);
return loading ? (
<Skeleton />
) : (
<div className="mx-auto px-6 max-w-[1400px] lg:flex pb-14">
<div className="flex flex-1 justify-end border-gray-400 pt-6 pr-8 md:border-r">
<div className="w-full max-w-[1024px] px-6">
<Header setOpen={() => console.log(111)} id={params.id} data={data} />
{/* <div className="flex items-center justify-between">
<div className="flex items-center text-sm text-gray-50">
{data?.created_at && (
<p>
{fromNow(data?.created_at * 1000)} by{' '}
<span className="underline">{data?.employer_user?.user_nick_name}</span>
</p>
)}
</div>
</div> */}
<div>
<h5 className="mt-4 mb-6 text-[42px] leading-[48px]">{data?.title}</h5>
</div>
<div className="flex text-gray-100">
<a className="text-gray" href={`/u/${data?.skill_user?.user_handle}`}>{data?.skill_user.user_nick_name}</a> ·
{data?.created_at && <p>{fromNow(data?.created_at * 1000)}</p>}
· {data?.view_num} Viewed
</div>
{/* <div className="mt-6 mb-9 rounded-md bg-[#f0f0f0] p-6">
<p>
Taking a look back at the brief history of the web, most would agree that Web 1.0 was epitomized by CGI
scripts generating templated content on a server and delivering it to the client in a final form. This was
a clear model of monolithic centralization, however, this basic form of interactivity was a huge
improvement over the basic post-and-read format that comprised much of internet content at that time.
</p>
</div> */}
<div className="my-6">
<h6 className="mb-6 text-lg">Self-Recommendation</h6>
{data?.rec && <OViewer value={data?.rec} />}
</div>
{/* <BountiesDetail data={data?.detail} /> */}
<SkillLabel userId={params.id}/>
<hr className="my-14 border-gray-400" />
<SkillOverviewView userId={params.id} />
<div className="h-6" />
{data?.onchain_show && nfts.length > 0 && (
<div>
<div className="mb-4 mt-14 flex items-center justify-between">
<h3>On-Chain Reputation</h3>
</div>
<div className="flex flex-wrap">
{nfts.map((i, k) => (
<img
width={64}
height={64}
className="mr-4 mb-4 rounded-full"
key={`On-Chain_Reputation_${k}`}
src={i.image_uri}
alt=""
/>
))}
</div>
</div>
)}
</div>
</div>
<Author data={data} />
</div>
);
}