From fd3580c0ca8f6ba9d3ca7e506b1a41fa3ada8753 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Poizat?= Date: Mon, 4 Nov 2024 14:21:25 +0100 Subject: [PATCH 1/2] feat: Display "View more contacts" button in popup --- .../view-more-contacts.component.html | 27 ++++++++++++++ .../view-more-contacts.component.ts | 24 ++++++++++++ apps/browser/src/popup/app-routing.module.ts | 8 ++++ apps/browser/src/popup/app.module.ts | 2 + apps/browser/src/popup/scss/pages.scss | 37 +++++++++++++++++++ .../vault/vault-items.component.html | 7 ++++ .../components/vault/vault-items.component.ts | 6 +++ 7 files changed, 111 insertions(+) create mode 100644 apps/browser/src/cozy/components/view-more-contacts/view-more-contacts.component.html create mode 100644 apps/browser/src/cozy/components/view-more-contacts/view-more-contacts.component.ts diff --git a/apps/browser/src/cozy/components/view-more-contacts/view-more-contacts.component.html b/apps/browser/src/cozy/components/view-more-contacts/view-more-contacts.component.html new file mode 100644 index 00000000000..5543a639864 --- /dev/null +++ b/apps/browser/src/cozy/components/view-more-contacts/view-more-contacts.component.html @@ -0,0 +1,27 @@ +
+
+
+ +
+

+ {{ "viewMoreContact" | i18n }} +

+
+
+
+
+
+

{{ "viewMoreContactInfo1" | i18n }}

+

{{ "viewMoreContactInfo2" | i18n }}

+ +
+ {{ "viewMoreContactRedirect" | i18n }} +
+
+
+
+
diff --git a/apps/browser/src/cozy/components/view-more-contacts/view-more-contacts.component.ts b/apps/browser/src/cozy/components/view-more-contacts/view-more-contacts.component.ts new file mode 100644 index 00000000000..e8aab4e91ed --- /dev/null +++ b/apps/browser/src/cozy/components/view-more-contacts/view-more-contacts.component.ts @@ -0,0 +1,24 @@ +import { Location } from "@angular/common"; +import { Component } from "@angular/core"; + +import { BrowserApi } from "../../../platform/browser/browser-api"; +import { CozyClientService } from "../../../popup/services/cozyClient.service"; + +@Component({ + selector: "app-vault-view-more-contacts", + templateUrl: "view-more-contacts.component.html", +}) +export class ViewMoreContactsComponent { + constructor( + private cozyClientService: CozyClientService, + private location: Location, + ) {} + + back() { + this.location.back(); + } + + protected async openContacts() { + await BrowserApi.createNewTab(this.cozyClientService.getAppURL("contacts", "")); + } +} diff --git a/apps/browser/src/popup/app-routing.module.ts b/apps/browser/src/popup/app-routing.module.ts index 12731c184fa..cb927290ea8 100755 --- a/apps/browser/src/popup/app-routing.module.ts +++ b/apps/browser/src/popup/app-routing.module.ts @@ -52,6 +52,7 @@ import { NotificationsSettingsComponent } from "../autofill/popup/settings/notif import { PremiumV2Component } from "../billing/popup/settings/premium-v2.component"; import { PremiumComponent } from "../billing/popup/settings/premium.component"; import { AddGenericComponent } from "../cozy/components/add-generic/add-generic.component"; +import { ViewMoreContactsComponent } from "../cozy/components/view-more-contacts/view-more-contacts.component"; import BrowserPopupUtils from "../platform/popup/browser-popup-utils"; import { popupRouterCacheGuard } from "../platform/popup/view-cache/popup-router-cache.service"; import { CredentialGeneratorHistoryComponent } from "../tools/popup/generator/credential-generator-history.component"; @@ -266,6 +267,13 @@ const routes: Routes = [ data: { state: "add-generic" }, runGuardsAndResolvers: "always", }, + { + path: "view-more-contacts", + component: ViewMoreContactsComponent, + canActivate: [authGuard, debounceNavigationGuard()], + data: { state: "view-more-contacts" }, + runGuardsAndResolvers: "always", + }, { path: "collections", component: CollectionsComponent, diff --git a/apps/browser/src/popup/app.module.ts b/apps/browser/src/popup/app.module.ts index 0865139100d..bd100d3e18d 100755 --- a/apps/browser/src/popup/app.module.ts +++ b/apps/browser/src/popup/app.module.ts @@ -94,6 +94,7 @@ import { TabsComponent } from "./tabs.component"; import { FlagConditionalComponent } from "../cozy/components/flag-conditional/flag-conditional.component"; import { IfFlagDirective } from "../cozy/components/flag-conditional/if-flag.directive"; import { AddGenericComponent } from "../cozy/components/add-generic/add-generic.component"; +import { ViewMoreContactsComponent } from "../cozy/components/view-more-contacts/view-more-contacts.component"; import { ViewExpirationDateComponent } from "../vault/popup/components/vault/view-expiration-date.component"; import { ViewLabelComponent } from "../vault/popup/components/vault/view-label.component"; import { ContactAvatarComponent } from "../vault/popup/components/vault/contact-avatar.component"; @@ -204,6 +205,7 @@ import "../platform/popup/locales"; FlagConditionalComponent, IfFlagDirective, AddGenericComponent, + ViewMoreContactsComponent, ViewExpirationDateComponent, ViewLabelComponent, ContactAvatarComponent, diff --git a/apps/browser/src/popup/scss/pages.scss b/apps/browser/src/popup/scss/pages.scss index e2c8442de9a..b782788bdb1 100644 --- a/apps/browser/src/popup/scss/pages.scss +++ b/apps/browser/src/popup/scss/pages.scss @@ -237,6 +237,43 @@ app-vault-share { /* Cozy custo */ +app-vault-view-more-contacts { + .box { + margin: 10px; + width: 90%; + } + + .view-more-contacts-redirect { + cursor: pointer; + border-width: 1px; + border-style: solid; + border-radius: 1.5rem; + width: fit-content; + padding: 0.5rem 1rem; + display: flex; + align-items: center; + gap: 0.8rem; + + &:hover { + @include themify($themes) { + background-color: themed("boxBackgroundHoverColor"); + } + } + + @include themify($themes) { + background-color: themed("boxBackgroundColor"); + border-color: themed("boxBorderColor"); + } + } + + .icon, + .icon-contacts { + line-height: 1rem; + width: 1rem; + height: 1rem; + } +} + app-help-and-feedback .box-content { padding-top: 25px; } diff --git a/apps/browser/src/vault/popup/components/vault/vault-items.component.html b/apps/browser/src/vault/popup/components/vault/vault-items.component.html index c296efb2cfd..b081c1ca43d 100644 --- a/apps/browser/src/vault/popup/components/vault/vault-items.component.html +++ b/apps/browser/src/vault/popup/components/vault/vault-items.component.html @@ -194,6 +194,13 @@

> + + + + + diff --git a/apps/browser/src/vault/popup/components/vault/vault-items.component.ts b/apps/browser/src/vault/popup/components/vault/vault-items.component.ts index b94dabc3389..a66a51ca366 100644 --- a/apps/browser/src/vault/popup/components/vault/vault-items.component.ts +++ b/apps/browser/src/vault/popup/components/vault/vault-items.component.ts @@ -493,6 +493,12 @@ export class VaultItemsComponent extends BaseVaultItemsComponent implements OnIn } // end custo + // Cozy customization, open view more contacts page + protected viewMoreContacts() { + this.router.navigate(["/view-more-contacts"]); + } + // Cozy customization end + // Cozy customization, override search method to always sort by date for papers protected async doSearch(indexedCiphers?: CipherView[]) { await super.doSearch(indexedCiphers); From a74e6533d0f41e0a75d5a6c46895a149b5ef690d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Th=C3=A9o=20Poizat?= Date: Mon, 4 Nov 2024 14:31:36 +0100 Subject: [PATCH 2/2] feat: Go directly to login creation when adding a suggestion Previouly, when we clicked on "Add a suggestion", we opened the AddGeneric component where we can choose what cipher we want to add. But suggestions are only login ciphers, so let's open directly the form to add a login cipher. --- .../vault/vault-filter.component.html | 2 +- .../vault/vault-filter.component.ts | 21 +++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/apps/browser/src/vault/popup/components/vault/vault-filter.component.html b/apps/browser/src/vault/popup/components/vault/vault-filter.component.html index 647bbcbb31a..c143681a4df 100644 --- a/apps/browser/src/vault/popup/components/vault/vault-filter.component.html +++ b/apps/browser/src/vault/popup/components/vault/vault-filter.component.html @@ -79,7 +79,7 @@

-