UNPKG

@particle-network/auth-core-modal

Version:

Auth Core provides MPC (Multi-Party Computation)-based threshold signatures.

86 lines (85 loc) 4.16 kB
"use client"; import{a as p}from"./chunk-CA2ONM6K.js";import{b as c}from"./chunk-6ART4FPU.js";import{a as d}from"./chunk-JLTVTEXA.js";import{H as l,sa as v,ua as u}from"./chunk-CNYYVI6H.js";import"./chunk-L535NPP3.js";import{getAuthorizationDApps as _}from"@particle-network/auth-core";import{useRequest as N}from"ahooks";import{Skeleton as b}from"antd";import k from"dayjs";import i,{useEffect as z}from"react";import{useTranslation as D}from"react-i18next";var g=`.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}=D(),m=v(),{modalOptions:h}=u(),{language:f}=l(),{loading:x,data:r=[],run:w}=N(()=>_().then(t=>t.map(e=>{var n,a;if(e.updated_at&&(e.updated_at=k(new Date(e.updated_at)).format("YYYY/MM/DD HH:mm")),h.projectId===e.project_app_uuid&&(e.isCurrent=!0),e.login_channel&&(e.login_channel=e.login_channel.replace(/( |^)[a-z]/g,s=>s.toUpperCase())),(n=e==null?void 0:e.location)!=null&&n.country_code)try{e.location.country_name=new Intl.DisplayNames([f||"en"],{type:"region"}).of((a=e==null?void 0:e.location)==null?void 0:a.country_code)}catch{}return e})),{cacheKey:"getAuthorizations",manual:!0});return z(()=>{w()},[]),i.createElement("div",{className:"device-list-container"},i.createElement("style",null,g),i.createElement(p,{displayBackBtn:!0},o("new.authorization")),i.createElement("div",{className:"scroll-wrapper"},i.createElement("div",{className:"devices-description"},o("new.authorization_tips")),x?i.createElement("div",{className:"device-list"},i.createElement(b,null)):i.createElement("div",{className:"device-list"},r==null?void 0:r.map((t,e)=>i.createElement("div",{className:"item",key:e,onClick:()=>{m("/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(c,{className:"arrow-right-icon",name:"arrow_right_icon"})))))),i.createElement(d,{className:"footer-box-v2"}))},K=j;export{K as default};