Skip to content

Instantly share code, notes, and snippets.

Avatar

Dhanik Lal Sahni dhaniksahni

View GitHub Profile
@dhaniksahni
dhaniksahni / commonDialog.html
Last active Sep 1, 2020
Common Dialog LWC Component
View commonDialog.html
<template>
<template if:true={open}>
<div>
<section role="dialog" tabindex="-1" class="slds-modal slds-fade-in-open">
<div class="slds-modal__container">
<header class="slds-modal__header">
<lightning-button-icon class="slds-modal__close" icon-name="utility:close" onclick={closeModal}></lightning-button-icon>
<h2>{title}</h2>
</header>
<div class="slds-modal__content slds-var-p-around_medium">
@dhaniksahni
dhaniksahni / SingleSelectDatatable.js
Created Aug 16, 2020
Single Row Selection in LWC
View SingleSelectDatatable.js
import { LightningElement, wire } from 'lwc';
import getContactList from '@salesforce/apex/ContactController.getContactList';
import { ShowToastEvent } from 'lightning/platformShowToastEvent';
const columns = [
{ label: 'First Name', fieldName: 'FirstName' },
{ label: 'Last Name', fieldName: 'LastName' },
{ label: 'Title', fieldName: 'Title' },
{ label: 'Phone', fieldName: 'Phone', type: 'phone' },
{ label: 'Email', fieldName: 'Email', type: 'email' }
View singleSelectDatatable.html
<template>
<template if:true={contact}>
<lightning-datatable key-field="Id"
data={contact}
columns={columns}>
</lightning-datatable>
</template>
</template>
@dhaniksahni
dhaniksahni / ObjectRecognition.css
Created Aug 8, 2020
ObjectRecognition in Lightning Web Component
View ObjectRecognition.css
.lgc-bg {
background-color: rgb(242, 242, 242);
}
.slds-spinner_container {
top: 50% !important;
bottom: 50% !important;
}
@dhaniksahni
dhaniksahni / ObjectRecogRequest.apxc
Last active Aug 8, 2020
Google Cloud Object Recognition
View ObjectRecogRequest.apxc
public class ObjectRecogRequest {
public list<request> requests{get;set;}
public class request{
public image image{get;set;}
public list<feature> features{get;set;}
}
public class image{
public Blob content{get;set;}
}
@dhaniksahni
dhaniksahni / imageMap.css
Created Aug 1, 2020
Dynamic Image Map in Salesfore LWC
View imageMap.css
.area
{
pointer-events:none;
}
@dhaniksahni
dhaniksahni / ImageMapController.apxc
Created Aug 1, 2020
Get Image Detail for Image map
View ImageMapController.apxc
public class ImageMapController {
@auraenabled(cacheable=true)
public static List<Image__c> getAllImages()
{
return [select id,name from Image__c];
}
@auraenabled(cacheable=true)
public static ImageResponse getImage(string id)
View logoRecognition.css
.lgc-bg {
background-color: rgb(242, 242, 242);
}
.slds-spinner_container {
top: 50% !important;
bottom: 50% !important;
}
@dhaniksahni
dhaniksahni / LogoRecognizer.apxc
Last active Jul 30, 2020
Logo Recognition Using Google in Salesforce
View LogoRecognizer.apxc
public class LogoRecognizer {
public static string getAccessToken()
{
GoogleAuthSetting__mdt mapping =
[SELECT AccessToken__c, Label FROM GoogleAuthSetting__mdt WHERE Label='Fitness' and DeveloperName='Fitness'];
return mapping.AccessToken__c;
}
@auraenabled(cacheable=true)
@dhaniksahni
dhaniksahni / viewFile.html
Last active Aug 1, 2020
View S3 File information using LWC
View viewFile.html
<template>
<template if:true={imageUrl}>
<iframe src={imageUrl}></iframe>
</template>
</template>