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

refactor: dead code removal. #92

Merged
merged 1 commit into from
Dec 12, 2023
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
140 changes: 0 additions & 140 deletions src/components/MultiLineInputBox.res

This file was deleted.

6 changes: 0 additions & 6 deletions src/components/NProgressIndicator.res

This file was deleted.

100 changes: 0 additions & 100 deletions src/components/Navbar.res
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
type appType = UPI | EULER
let bgClass = "bg-white hover:bg-jp-gray-100"
@val @scope(("window", "location")) external pathName: string = "pathname"

module MenuOption = {
@react.component
Expand All @@ -19,104 +17,6 @@ module MenuOption = {
}
}

module NameIcon = {
@react.component
let make = (~name, ~onClick=?) => {
let words =
name
->Js.String2.toUpperCase
->Js.String2.replaceByRe(%re("/_/g"), " ")
->Js.String2.split(" ")
->Js.Array2.filter(x => x !== "")
let firstLetters =
words->Js.Array2.map(word => Js.String2.charAt(word, 0))->Js.Array2.joinWith("")
<div ?onClick className="flex items-center justify-center h-8 w-8 rounded-full bg-gray-200">
{firstLetters->Js.String2.slice(~from=0, ~to_=2)->React.string}
</div>
}
}

module FeedbackModal = {
@react.component
let make = (~setShowModal, ~showModal) => {
let makeFieldInfo = FormRenderer.makeFieldInfo
let field = makeFieldInfo(
~label="",
~name="feedbacks",
~placeholder="Please provide your feedback/suggestions here ...",
~customInput=InputFields.multiLineTextInput(
~isDisabled=false,
~rows=Some(6),
~cols=Some(4),
(),
),
(),
)

let selectBetween = makeFieldInfo(
~name="category",
~label="",
~customInput=InputFields.radioInput(
~options=["Suggestion", "Bugs", "Other"]->SelectBox.makeOptions,
~buttonText="options",
~isHorizontal=true,
(),
),
(),
)

let validate = values => {
let errors = Js.Dict.empty()
let values = values->LogicUtils.getDictFromJsonObject
if values->LogicUtils.getString("feedbacks", "") === "" {
errors->Js.Dict.set("feedbacks", "Please give the feedback"->Js.Json.string)
}
if values->LogicUtils.getString("category", "") === "" {
errors->Js.Dict.set("category", "Please select the category"->Js.Json.string)
}
if values->LogicUtils.getInt("rating", -1) === -1 {
errors->Js.Dict.set("rating", "Please rate"->Js.Json.string)
}
errors->Js.Json.object_
}

let onSubmit = (_, _) => {
setShowModal(_ => false)
Js.Nullable.null->Js.Promise.resolve
}

<Modal
modalHeading="Send Us Your Feedback"
modalHeadingDescription="Tell us what you liked most and if you have a suggestion or found some bug, let us know in the field below"
headingClass="!bg-transparent"
showModal
setShowModal
borderBottom=true
closeOnOutsideClick=true
modalClass="md:w-2/5 mx-auto my-8 p-4 pb-8">
<ReactFinalForm.Form
subscription=ReactFinalForm.subscribeToValues
onSubmit
validate
render={({handleSubmit}) => {
<form onSubmit={handleSubmit}>
<div className="flex flex-col justify-center mb-2">
<RatingOptions
icons=["angry", "frown", "smile", "smile-beam", "grin-hearts"] size=45
/>
<FormRenderer.FieldRenderer field />
<FormRenderer.FieldRenderer field=selectBetween />
<div className="flex justify-end p-1 mt-4">
<FormRenderer.SubmitButton text="Send Feedback" />
</div>
</div>
</form>
}}
/>
</Modal>
}
}

@react.component
let make = (
~headerActions=?,
Expand Down
12 changes: 0 additions & 12 deletions src/components/NewCalendarList.res
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,6 @@ open DateTimeUtils
external ffInputToSelectInput: ReactFinalForm.fieldRenderPropsInput => ReactFinalForm.fieldRenderPropsCustomInput<
array<string>,
> = "%identity"
let getStrArray = jsonArr => {
jsonArr->Js.Array2.reduce((acc, jsonElement) => {
switch jsonElement->Js.Json.decodeString {
| Some(str) => {
let _ = Js.Array2.push(acc, str)
}

| None => ()
}
acc
}, [])
}

open NewCalendar
@react.component
Expand Down
2 changes: 1 addition & 1 deletion src/components/NewDateRangePicker.res
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ let useErroryValueResetter = (
React.useEffect1(() => {
let isErroryTimeValue = value => {
try {
let _checkEnd = value->isoStringToCustomTimeZone
let _ = value->isoStringToCustomTimeZone
false
} catch {
| _error => true
Expand Down
7 changes: 0 additions & 7 deletions src/components/NewPagination.res
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
module PaginationButton = {
@react.component
let make = (~onClick, ~text) => {
<button onClick> {text->React.string} </button>
}
}

@react.component
let make = (~resultsPerPage, ~totalResults, ~currentPage, ~paginate, ~btnCount=4) => {
let pageNumbers = []
Expand Down
14 changes: 1 addition & 13 deletions src/components/NoDataFound.res
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
type renderType = InfoBox | Painting | NotFound | Locked | LoadError | UPINoDataFoundPage
type renderType = InfoBox | Painting | NotFound | Locked | LoadError

@react.component
let make = (
Expand All @@ -19,7 +19,6 @@ let make = (
| Locked => "mt-32 p-16"
| LoadError => "mt-32 p-16"
| InfoBox => ""
| UPINoDataFoundPage => "mt-32 p-16"
}
isMobileView ? "" : marginPaddingClass
}
Expand Down Expand Up @@ -99,17 +98,6 @@ let make = (
}}
</div>
</div>
| UPINoDataFoundPage =>
<div className={`${containerClass}`}>
<img className="w-1/2" src={`icons/upilogo2.svg`} />
<div className="p-2 mt-8 text-black text-2xl text-bold"> {React.string(message)} </div>
<div>
{switch children {
| Some(child) => child
| None => React.null
}}
</div>
</div>
}}
</div>
</div>}
Expand Down
8 changes: 0 additions & 8 deletions src/components/NoteUI.res

This file was deleted.

6 changes: 0 additions & 6 deletions src/components/Pagination.res
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
module PaginationButton = {
@react.component
let make = (~onClick, ~text) => {
<button onClick> {text->React.string} </button>
}
}
external formEventToInt: ReactEvent.Form.t => int = "%identity"

@react.component
Expand Down
Loading