@particle-network/authkit
Version:
Auth Core provides MPC (Multi-Party Computation)-based threshold signatures.
86 lines (85 loc) • 4.16 kB
JavaScript
"use client";
import{a as v}from"./chunk-SL2KVVUD.mjs";import{b as d}from"./chunk-GKIRU5P2.mjs";import{a as p}from"./chunk-CHA6AH7V.mjs";import{I as l,sa as u,ta as g,va as h}from"./chunk-45SUOK7A.mjs";import"./chunk-2FKLQE76.mjs";import{getAuthorizationDApps as N}from"@particle-network/auth-core";import{useRequest as b}from"ahooks";import{Skeleton as k}from"antd";import z from"dayjs";import i,{useEffect as D}from"react";var m=`.device-list-container {
display: flex;
flex-direction: column;
width: 100%;
height: 100%;
color: var(--text-color);
}
.device-list-container .scroll-wrapper {
flex: 1;
overflow: auto;
}
.device-list-container .devices-description {
margin: 32px 18px 40px;
font-weight: 400;
font-size: 13px;
color: var(--secondary-text-color);
}
.device-list-container .ant-spin-nested-loading > div > .ant-spin {
top: 10vh;
}
.device-list-container .device-list {
width: 100%;
padding: 0 18px;
}
.device-list-container .device-list .ant-skeleton-content .ant-skeleton-title {
display: none;
}
.device-list-container .device-list .item {
display: flex;
justify-content: space-between;
align-items: center;
height: 70px;
padding: 0 12px 0 14px;
margin-bottom: 10px;
border-radius: var(--card-border-radius);
background: var(--card-unclickable-background-color);
cursor: pointer;
}
.device-list-container .device-list .item .device {
font-weight: 500;
font-size: 14px;
}
.device-list-container .device-list .item .created_at {
margin-top: 4px;
font-weight: 400;
font-size: 12px;
line-height: 1.2;
color: var(--secondary-text-color);
}
.device-list-container .device-list .item .right {
display: flex;
justify-content: flex-end;
align-items: center;
gap: 8px;
}
.device-list-container .device-list .item .right .arrow-right-icon {
color: var(--text-color);
}
.device-list-container .device-list .item .right .arrow-right-icon svg {
width: 12px;
height: 12px;
}
.device-list-container .device-list .item .right .current-icon {
position: relative;
height: 20px;
padding: 0 10px;
border-radius: 30px;
overflow: hidden;
font-size: 13px;
line-height: 20px;
white-space: nowrap;
color: var(--accent-color);
}
.device-list-container .device-list .item .right .current-icon::after {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: var(--accent-color);
opacity: 0.15;
content: '';
}
`;var j=()=>{let{t:o}=h(),f=u(),{modalOptions:n}=g(),{language:x}=l(),{loading:w,data:r=[],run:y}=b(()=>N().then(t=>t.map(e=>{var a,s;if(e.updated_at&&(e.updated_at=z(new Date(e.updated_at)).format("YYYY/MM/DD HH:mm")),(n.projectId===e.project_app_uuid||n.appId===e.project_app_uuid)&&(e.isCurrent=!0),e.login_channel&&(e.login_channel=e.login_channel.replace(/( |^)[a-z]/g,c=>c.toUpperCase())),(a=e==null?void 0:e.location)!=null&&a.country_code)try{e.location.country_name=new Intl.DisplayNames([x||"en"],{type:"region"}).of((s=e==null?void 0:e.location)==null?void 0:s.country_code)}catch{}return e})),{cacheKey:"getAuthorizations",manual:!0});return D(()=>{y()},[]),i.createElement("div",{className:"device-list-container"},i.createElement("style",null,m),i.createElement(v,{displayBackBtn:!0},o("new.authorization")),i.createElement("div",{className:"scroll-wrapper"},i.createElement("div",{className:"devices-description"},o("new.authorization_tips")),w?i.createElement("div",{className:"device-list"},i.createElement(k,null)):i.createElement("div",{className:"device-list"},r==null?void 0:r.map((t,e)=>i.createElement("div",{className:"item",key:e,onClick:()=>{f("/manageDevices/deviceDetails",{state:{loginDeviceInfo:t}})}},i.createElement("div",{className:"left"},i.createElement("div",{className:"wrap"},i.createElement("div",{className:"s-row device"},t.project_app_name),i.createElement("div",{className:"s-row created_at"},t.updated_at))),i.createElement("div",{className:"right"},t.isCurrent&&i.createElement("div",{className:"current-icon"},o("new.current")),i.createElement(d,{className:"arrow-right-icon",name:"arrow_right_icon"})))))),i.createElement(p,{className:"footer-box-v2"}))},G=j;export{G as default};