Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ESLint issues #17

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/apps/kfone-customer-support/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"test": "react-scripts test",
"eject": "react-scripts eject",
"lint": "eslint . --ext .js,.jsx,.ts,.tsx",
"lint:fix": "eslint --fix",
"format": "prettier --write './**/*.{js,jsx,ts,tsx,css,md,json}' --config ./.prettierrc"
"lint:fix": "eslint . --ext .js,.jsx,.ts,.tsx --fix",
"format": "prettier --write './**/*.{js,jsx,ts,tsx,css,md,json}'"
},
"dependencies": {
"@asgardeo/auth-react": "^1.1.18",
Expand Down
22 changes: 20 additions & 2 deletions src/apps/kfone-customer-support/postcss.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,25 @@
/**
* Copyright (c) 2022, WSO2 LLC. (https://www.wso2.com). All Rights Reserved.
*
* WSO2 LLC. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
...(process.env.NODE_ENV === 'production' ? { cssnano: {} } : {})
...(process.env.NODE_ENV === 'production' ? {cssnano: {}} : {}),
},
}
};
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,9 @@ export const PrimaryButton: FC<PrimaryButtonProps> = ({
const classes: string = clsx(
'flex text-white right-2.5 bottom-2.5 bg-primary',
'focus:ring-4 focus:outline-none focus:ring-blue-300',
'font-medium rounded-lg text-sm px-4 py-2 opacity-100',
'font-medium rounded-lg text-sm px-4 py-2',
{
'opacity-100': !disabled,
'opacity-50': disabled,
},
className,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
* under the License.
*/

/* eslint-disable jsx-a11y/anchor-is-valid */

import clsx from 'clsx';
import {DetailedHTMLProps, FC, LiHTMLAttributes, ReactElement, useMemo} from 'react';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ export type SideBarProps = DetailedHTMLProps<LiHTMLAttributes<HTMLLIElement>, HT
*/
export const SideBar: FC<SideBarProps> = ({className}: SideBarProps): ReactElement => {
const classes: string = clsx(
'w-[250px] fixed inset-y-0 antialiased transition-transform duration-200 -translate-x-full xl:translate-x-0 bg-white shadow-xl z-990',
'w-[250px] fixed inset-y-0 antialiased transition-transform duration-200',
'-translate-x-full xl:translate-x-0 bg-white shadow-xl z-990',
className,
);

Expand Down
5 changes: 4 additions & 1 deletion src/apps/kfone-customer-support/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,10 @@ export const Root: FC<RootProps> = (): ReactElement => {
</span>
<br />
<a
href="https://github.com/wso2/devrel/blob/Kubecon-demos/kfone-customer-support/README.md#lets-setup-the-environment-variables"
href={
'https://github.com/wso2/devrel/blob/Kubecon-demos/kfone-customer-support/README.md' +
'#lets-setup-the-environment-variables'
}
target="_blank"
rel="noreferrer"
className="text-blue-800 underline text-sm"
Expand Down
33 changes: 28 additions & 5 deletions src/apps/kfone-customer-support/src/pages/cases-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -90,26 +90,49 @@ export const CasesPage: FC<CasesPageProps> = ({className}: CasesPageProps): Reac
</div>
<div className="flex items-center justify-between mb-4 space-x-12">
{item?.isInProgress ? (
<span className="px-2 py-1 flex items-center font-semibold text-xs rounded-lg text-gray-500 bg-gray-200">
<span
className={
'px-2 py-1 flex items-center font-semibold text-xs rounded-lg text-gray-500 bg-gray-200'
}
>
PROGRESS
</span>
) : (
<span className="px-2 py-1 flex items-center font-semibold text-xs rounded-lg text-green-700 bg-green-50">
<span
className={
'px-2 py-1 flex items-center font-semibold text-xs rounded-lg text-green-700 bg-green-50'
}
>
COMPLETED
</span>
)}

{item?.priority === 'MEDIUM' ? (
<span className="px-2 py-1 flex items-center font-semibold text-xs rounded-lg text-green-600 border border-green-600 bg-white">
<span
className={
'px-2 py-1 flex items-center font-semibold text-xs rounded-lg ' +
'text-green-600 border border-green-600 bg-white'
}
>
MEDIUM
</span>
) : (
<span className="px-2 py-1 flex items-center font-semibold text-xs rounded-lg text-red-400 border border-red-400 bg-white">
<span
className={
'px-2 py-1 flex items-center font-semibold text-xs rounded-lg ' +
'text-red-400 border border-red-400 bg-white'
}
>
HIGH
</span>
)}
</div>
<span className="px-2 py-1 flex w-36 mt-4 items-center text-xs rounded-lg font-semibold text-yellow-500 bg-yellow-100">
<span
className={
'px-2 py-1 flex w-36 mt-4 items-center text-xs rounded-lg ' +
'font-semibold text-yellow-500 bg-yellow-100'
}
>
DUE DATE : {item?.dueDate}
</span>
</div>
Expand Down
41 changes: 31 additions & 10 deletions src/apps/kfone-customer-support/src/pages/customers-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import {Chart as ChartJS, ArcElement, Tooltip, Legend} from 'chart.js';
import {Doughnut} from 'react-chartjs-2';
import {useAuthContext} from '@asgardeo/auth-react';
import {DetailedHTMLProps, FC, HTMLAttributes, ReactElement, useMemo, useState} from 'react';
import {useLocation} from 'react-router-dom';
import {FcCancel, FcOk} from 'react-icons/fc';
import {DashboardLayout} from '../layouts';
import {PreLoader} from '../components';
Expand Down Expand Up @@ -118,6 +117,10 @@ export const CustomersPage: FC<CustomersPageProps> = (): ReactElement => {
}
};

const getCustomerName = (userInfo: UserInfo): string => {
return `${userInfo?.personalDetails?.name?.givenName} ${userInfo?.personalDetails?.name?.familyName}`;
};

return (
<>
{state.isAuthenticated && !state.isLoading ? (
Expand Down Expand Up @@ -146,13 +149,19 @@ export const CustomersPage: FC<CustomersPageProps> = (): ReactElement => {
<input
type="search"
id="default-search"
className="block p-4 pl-10 w-full text-sm text-gray-900 bg-gray-50 rounded-lg border border-gray-300 focus:ring-blue-500 focus:border-blue-500"
className={
'block p-4 pl-10 w-full text-sm text-gray-900 bg-gray-50 rounded-lg border ' +
'border-gray-300 focus:ring-blue-500 focus:border-blue-500'
}
placeholder="Search via mobile"
onChange={e => setMobileNumber(e.target.value)}
required
/>
<button
className="text-white absolute right-2.5 bottom-2.5 bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-4 py-2"
className={
'text-white absolute right-2.5 bottom-2.5 bg-blue-700 hover:bg-blue-800 ' +
'focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-4 py-2'
}
onClick={retrieveUserInfo}
>
{isUserInfoLoading && (
Expand All @@ -164,10 +173,12 @@ export const CustomersPage: FC<CustomersPageProps> = (): ReactElement => {
xmlns="http://www.w3.org/2000/svg"
>
<path
// eslint-disable-next-line max-len
d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z"
fill="#E5E7EB"
/>
<path
// eslint-disable-next-line max-len
d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z"
fill="currentColor"
/>
Expand All @@ -181,7 +192,11 @@ export const CustomersPage: FC<CustomersPageProps> = (): ReactElement => {
<div className="flex flex-wrap">
{isUserInfoLoading && (
<div className="absolute right-1/2 bottom-1/2 transform translate-x-1/2 translate-y-1/2 ">
<div className="border-t-transparent border-primary animate-spin rounded-full border-blue-400 border-8 h-48 w-48"></div>
<div
className={
'border-t-transparent border-primary animate-spin rounded-full border-blue-400 border-8 h-48 w-48'
}
></div>
</div>
)}

Expand All @@ -202,6 +217,7 @@ export const CustomersPage: FC<CustomersPageProps> = (): ReactElement => {
>
<path
fill="currentColor"
// eslint-disable-next-line max-len
d="M256 8C119 8 8 119 8 256s111 248 248 248 248-111 248-248S393 8 256 8zm121.6 313.1c4.7 4.7 4.7 12.3 0 17L338 377.6c-4.7 4.7-12.3 4.7-17 0L256 312l-65.1 65.6c-4.7 4.7-12.3 4.7-17 0L134.4 338c-4.7-4.7-4.7-12.3 0-17l65.6-65-65.6-65.1c-4.7-4.7-4.7-12.3 0-17l39.6-39.6c4.7-4.7 12.3-4.7 17 0l65 65.7 65.1-65.6c4.7-4.7 12.3-4.7 17 0l39.6 39.6c4.7 4.7 4.7 12.3 0 17L312 256l65.6 65.1z"
></path>
</svg>
Expand Down Expand Up @@ -256,10 +272,7 @@ export const CustomersPage: FC<CustomersPageProps> = (): ReactElement => {
Mobile Number : {userInfo?.personalDetails?.phoneNumbers[0]?.value}
</span>
)}
<span className="mt-2 text-sm text-gray-500 ml-2">
Name :{' '}
{`${userInfo?.personalDetails?.name?.givenName} ${userInfo?.personalDetails?.name?.familyName}`}
</span>
<span className="mt-2 text-sm text-gray-500 ml-2">Name : {getCustomerName(userInfo)}</span>
</div>
</div>
</div>
Expand Down Expand Up @@ -347,7 +360,12 @@ export const CustomersPage: FC<CustomersPageProps> = (): ReactElement => {

{userInfo?.billingData?.pastBillingCycles?.length > 0 && (
<div className="w-full md:w-1/2 lg:w-1/3 pr-4 pb-4">
<div className="relative flex flex-col h-full min-w-0 break-words bg-white border-0 border-transparent border-solid shadow-xl rounded-lg bg-clip-border">
<div
className={
'relative flex flex-col h-full min-w-0 break-words bg-white border-0 ' +
'border-transparent border-solid shadow-xl rounded-lg bg-clip-border'
}
>
<div className="p-4 pb-0 mb-0 border-b-0 border-b-solid rounded-t-2xl border-b-transparent">
<div className="flex flex-wrap -mx-3">
<div className="flex items-center flex-none w-1/2 max-w-full px-3">
Expand All @@ -362,7 +380,10 @@ export const CustomersPage: FC<CustomersPageProps> = (): ReactElement => {
// TODO: add random key over the index
<li
key={index}
className="relative flex justify-between px-4 py-2 pl-0 mb-2 border-0 rounded-t-inherit text-inherit rounded-lg"
className={
'relative flex justify-between px-4 py-2 pl-0 mb-2 border-0 ' +
'rounded-t-inherit text-inherit rounded-lg'
}
>
<div className="flex flex-col">
<h6 className="mb-1 text-sm font-semibold leading-normal text-slate-700">
Expand Down
7 changes: 6 additions & 1 deletion src/apps/kfone-customer-support/src/pages/home-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,12 @@ export const HomePage: FC<HomePageProps> = (): ReactElement => {
<div className="overflow-auto h-screen pb-24 pt-2 pr-2 pl-2 md:pt-0 md:pr-0 md:pl-0">
<div className="flex flex-col flex-wrap sm:flex-row ">
<div className="w-full max-w-full px-3 mt-0 lg:w-7/12 lg:flex-none">
<div className="border-black/12.5 shadow-xl relative z-20 flex min-w-0 flex-col break-words rounded-2xl border-0 border-solid bg-white bg-clip-border">
<div
className={
'border-black/12.5 shadow-xl relative z-20 flex min-w-0 flex-col break-words ' +
'rounded-2xl border-0 border-solid bg-white bg-clip-border'
}
>
<div className="border-black/12.5 mb-0 rounded-t-2xl border-b-0 border-solid p-6 pt-4 pb-0">
<h6 className="capitalize font-bold mb-2">Customer Satisfaction overview</h6>
<p className="mb-0 text-sm leading-normal">
Expand Down
Loading