@particle-network/authkit
Version:
Auth Core provides MPC (Multi-Party Computation)-based threshold signatures.
80 lines (79 loc) • 4.08 kB
JavaScript
"use client";
import{a as f}from"./chunk-YAWI32JU.mjs";import{g as h}from"./chunk-NSWCC5PG.mjs";import{a as u}from"./chunk-BM7ICTT2.mjs";import{a as m}from"./chunk-ZTTU2K7E.mjs";import"./chunk-UXH6IVHO.mjs";import"./chunk-GYYKKPHD.mjs";import"./chunk-3RRPQ2DX.mjs";import{Y as g,h as d,o as l,p,r as v}from"./chunk-H6TXMQRA.mjs";import"./chunk-C7OWFSST.mjs";import{getAuthorizationDApps as z}from"@particle-network/auth-core";import D from"ahooks/es/useRequest";import k from"dayjs";import i,{useEffect as j}from"react";var x=`.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 .device-list {
width: 100%;
padding: 0 18px;
}
.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 C=()=>{let{t:o}=v(),w=l(),{modalOptions:n}=p(),{language:y}=g(),{loading:_,data:r=[],run:N}=D(()=>z().then(t=>t.map(e=>{var a,c;if(e.updated_at&&(e.updated_at=k(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,s=>s.toUpperCase())),(a=e==null?void 0:e.location)!=null&&a.country_code)try{e.location.country_name=new Intl.DisplayNames([y||"en"],{type:"region"}).of((c=e==null?void 0:e.location)==null?void 0:c.country_code)}catch{}return e})),{cacheKey:"getAuthorizations",manual:!0});return j(()=>{N()},[]),i.createElement("div",{className:"device-list-container"},i.createElement("style",null,d(x)),i.createElement(f,{displayBackBtn:!0},o("new.authorization")),i.createElement("div",{className:"scroll-wrapper"},i.createElement("div",{className:"devices-description"},o("new.authorization_tips")),_?i.createElement("div",{className:"device-list"},i.createElement(h,null)):i.createElement("div",{className:"device-list"},r==null?void 0:r.map((t,e)=>i.createElement("div",{className:"item",key:e,onClick:()=>{w("/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(u,{className:"arrow-right-icon",name:"arrow_right_icon"})))))),i.createElement(m,{className:"footer-box-v2"}))},K=C;export{K as default};