Skip to content

Commit

Permalink
Merge pull request #34 from Sphereon-Opensource/feat/CWALL-250
Browse files Browse the repository at this point in the history
feat/CWALL-250
  • Loading branch information
BtencateSphereon authored Sep 12, 2024
2 parents 05c2811 + a83e2c3 commit 9640e7a
Show file tree
Hide file tree
Showing 10 changed files with 365 additions and 52 deletions.
7 changes: 4 additions & 3 deletions packages/web-wallet/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@
"@sphereon/ssi-sdk.siopv2-oid4vp-op-auth": "0.29.1-next.82",
"@sphereon/ssi-sdk.w3c-vc-api-issuer-rest-client": "0.29.1-next.82",
"@sphereon/ssi-types": "0.29.1-next.82",
"@sphereon/ui-components.core": "0.3.1-next.6",
"@sphereon/ui-components.credential-branding": "0.3.1-next.6",
"@sphereon/ui-components.ssi-react": "0.3.1-next.6",
"@sphereon/ui-components.core": "0.3.1-next.16",
"@sphereon/ui-components.credential-branding": "0.3.1-next.16",
"@sphereon/ui-components.ssi-react": "0.3.1-next.16",
"web-did-resolver": "^2.0.27",
"@supabase/postgrest-js": "1.15.2",
"@supabase/storage-js": "2.6.0",
Expand All @@ -74,6 +74,7 @@
"@veramo/did-provider-key": "4.2.0",
"@veramo/did-resolver": "4.2.0",
"@veramo/remote-client": "4.2.0",
"@veramo/utils": "4.2.0",
"@xstate/react": "3.2.2",
"axios": "^1.7.2",
"babel-plugin-module-resolver": "^5.0.2",
Expand Down
4 changes: 2 additions & 2 deletions packages/web-wallet/pages/credentials/create/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import PageHeaderBar from '@components/bars/PageHeaderBar'
import {Outlet} from 'react-router-dom'
import {useCredentialsCreateMachine} from '@machines/credentials/credentialsCreateStateNavigation'
import QRCodeModal, {QRValueResult} from 'src/components/modals/QRCodeModal'
import {createCredentialPayloadWithSchema, qrValueGenerator} from '../../../src/services/credentials/CredentialService'
import {staticPropsWithSST} from '../../../src/i18n/server'
import {createCredentialPayloadWithSchema, qrValueGenerator} from '@/src/services/credentials/CredentialService'
import {staticPropsWithSST} from '@/src/i18n/server'

const CredentialsCreatePage: FC = () => {
const translate = useTranslate()
Expand Down
8 changes: 7 additions & 1 deletion packages/web-wallet/public/locales/en/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,7 @@
"issue_credential_enter_issue_method_description": "You can choose how you want to issue the credential to the person or subject.",
"issue_credential_path_label": "credentials / issue credential",
"credentials_overview_action_add_credential": "Add new credential",
"credentials_overview_action_import_credential": "Import credential",
"unknown_label": "Unknown",
"credential_issuance_method_qr_code_label": "QR-code",
"credential_issuance_column_card_label": "Card",
Expand Down Expand Up @@ -394,5 +395,10 @@
"credential_catalog_column_credential_description_label": "Description",
"credential_catalog_column_actions_label": "Actions",
"credential_catalog_card_view_display_mode": "Card view",
"credential_catalog_list_view_display_mode": "List view"
"credential_catalog_list_view_display_mode": "List view",
"action_import_label": "Import",
"import_credential_modal_header_title": "Import credential",
"import_credential_modal_header_subtitle": "Please click or drag a file onto the box to import it as a credential.",
"import_credential_modal_dragbox_caption": "Click or drag to import a credential",
"import_credential_modal_dragbox_description": "This credential will be imported and will be available in the overview."
}
8 changes: 7 additions & 1 deletion packages/web-wallet/public/locales/nl/common.json
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@
"issue_credential_enter_issue_method_description": "U kunt kiezen hoe u de credential aan de persoon of het onderwerp wilt verstrekken.",
"issue_credential_path_label": "credentials / uitgeven credential",
"credentials_overview_action_add_credential": "Credential toevoegen",
"credentials_overview_action_import_credential": "Importeer credential",
"unknown_label": "Onbekend",
"credential_issuance_method_qr_code_label": "QR-code",
"credential_issuance_column_card_label": "Kaart",
Expand Down Expand Up @@ -392,5 +393,10 @@
"credential_catalog_column_credential_description_label": "Beschrijving",
"credential_catalog_column_actions_label": "Acties",
"credential_catalog_card_view_display_mode": "Kaartweergave",
"credential_catalog_list_view_display_mode": "Lijstweergave"
"credential_catalog_list_view_display_mode": "Lijstweergave",
"action_import_label": "Import",
"import_credential_modal_header_title": "Credential importeren",
"import_credential_modal_header_subtitle": "Klik of sleep een bestand naar het vak om het als een credential te importeren.",
"import_credential_modal_dragbox_caption": "Klik of sleep om een credential te importeren",
"import_credential_modal_dragbox_description": "Deze credential wordt geïmporteerd en zal beschikbaar zijn in het overzicht."
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
.overlay {
position: absolute;
z-index: 1;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: rgba(217,217,217, 0.6);
align-items: center;
justify-content: center;
display: flex;
}

.container {
border-radius: 24px;
background-color: #FBFBFB;
overflow: hidden;
display: flex;
flex-direction: column;
}

.headerContainer {
display: flex;
flex-direction: row;
padding-left: 49px;
padding-right: 15px;
}

.headerCaptionContainer {
flex-grow: 1;
padding-top: 50px;
display: flex;
flex-direction: column;
gap: 10px;
}

.headerCloseContainer {
margin-left: auto;
padding-top: 16px;
}

.closeButton {
display: flex;
aspect-ratio: 1;
cursor: pointer;
align-items: center;
justify-content: center;
width: 52px;
}

.titleCaption {
font-size: 24px;
font-style: normal;
font-weight: 500;
line-height: normal;
}

.subTitleCaption {
font-size: 14px;
font-style: normal;
font-weight: 400;
line-height: normal;
letter-spacing: 0.14px;
}

.contentContainer {
padding: 24px 49px;
display: flex;
flex-direction: column;
gap: 24px;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
import React, {FC, ReactElement, useState} from 'react';
import {useTranslate} from '@refinedev/core';
import {PrimaryButton} from '@sphereon/ui-components.ssi-react';
import CrossIcon from '@components/assets/icons/CrossIcon';
import DragAndDropBox from '@components/fields/DragAndDropBox';
import FileSelectionField from '@components/fields/FileSelectionField';
import style from './index.module.css'

type Props = {
headerTitle?: string
headerSubTitle?: string
dragBoxCaption: string
dragBoxDescription?: string
onImportFile: (file: File) => Promise<void>
onValidateFile?: (file: File) => Promise<boolean>
onClose: () => Promise<void>
fileMask?: RegExp
}

const ImportFileModal: FC<Props> = (props: Props): ReactElement => {
const {
headerTitle,
headerSubTitle,
dragBoxCaption,
dragBoxDescription,
onImportFile,
onValidateFile,
onClose
} = props
const translate = useTranslate()
const [file, setFile] = useState<File | undefined>()

const onChangeFile = async (file: File): Promise<void> => {
if (onValidateFile) {
const validationResult = await onValidateFile(file).then(
(result) => result,
() => false
);

if (!validationResult) {
return
}
}

setFile(file)
}

const onImport = async (): Promise<void> => {
if (!file) {
return
}

void onImportFile(file)
}

return (
<div
className={style.overlay}
onClick={onClose}
>
<div className={style.container} onClick={(event: React.MouseEvent<HTMLDivElement, MouseEvent>) => event.stopPropagation()}>
<div className={style.headerContainer}>
{(headerTitle || headerSubTitle) &&
<div className={style.headerCaptionContainer}>
{headerTitle && <div className={style.titleCaption}>{headerTitle}</div>}
{headerSubTitle && <div className={style.subTitleCaption}>{headerSubTitle}</div>}
</div>
}
<div className={style.headerCloseContainer}>
<div className={style.closeButton} onClick={onClose}>
<CrossIcon />
</div>
</div>
</div>
<div className={style.contentContainer}>
<DragAndDropBox
caption={dragBoxCaption}
description={dragBoxDescription}
onChangeFile={onChangeFile}
/>
{file && <FileSelectionField file={file} />}
<PrimaryButton
style={{width: 180, marginLeft: 'auto'}}
caption={translate('action_import_label')}
disabled={!file}
onClick={onImport}
/>
</div>
</div>
</div>
)
}

export default ImportFileModal
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ const ContactsList: FC<Props> = (props: Props): ReactElement => {
)),
)
const columns = generateHeader({
type: orderAndOmitContactProperties(partiesOfType[0]?.contact || createEmptyContactOfType(key), ['createdAt', 'lastUpdatedAt']),
type: orderAndOmitContactProperties(partiesOfType[0]?.contact || createEmptyContactOfType(key), ['createdAt', 'lastUpdatedAt', 'metadata', 'ownerId', 'tenantId']),
truncationLength,
labelPrefix: `${key}_fields`,
})
Expand Down
Loading

0 comments on commit 9640e7a

Please sign in to comment.