-
Notifications
You must be signed in to change notification settings - Fork 75
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
UI: Edit page allocated devices #1588
Merged
Merged
Changes from 1 commit
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
b28e466
Edit page allocated devices tab
Shruti-Apte 160808d
Merge branch 'develop' into allocatedDevices_edit_page
Shruti-Apte 2bc45f1
worked on review commits and modified some code
Shruti-Apte 821a331
worked on review comments
Shruti-Apte fe29bea
Merge branch 'develop' into allocatedDevices_edit_page
Shruti-Apte File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
101 changes: 101 additions & 0 deletions
101
app/javascript/src/components/Profile/UserDetail/AllocatedDevicesDetails/Edit/EditPage.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
import React from "react"; | ||
|
||
import { MobileIcon } from "miruIcons"; | ||
import "react-phone-number-input/style.css"; | ||
import { Button } from "StyledComponents"; | ||
|
||
import { CustomInputText } from "common/CustomInputText"; | ||
import { CustomReactSelect } from "common/CustomReactSelect"; | ||
|
||
const EditPage = () => ( | ||
<div className="mt-4 h-full bg-miru-gray-100 px-10"> | ||
prasanthchaduvula marked this conversation as resolved.
Show resolved
Hide resolved
|
||
<div className="flex border-b border-b-miru-gray-400 py-10"> | ||
<div className="flex w-1/5 pr-4"> | ||
<MobileIcon | ||
className="mr-2 mt-1 text-miru-dark-purple-1000" | ||
size={16} | ||
weight="bold" | ||
/> | ||
<span className="text-sm font-medium text-miru-dark-purple-1000"> | ||
Devices | ||
</span> | ||
</div> | ||
<div className="w-9/12"> | ||
<div className="flex flex-row py-3"> | ||
<div className="flex w-1/2 flex-col px-2"> | ||
<CustomReactSelect | ||
// handleOnChange={} | ||
prasanthchaduvula marked this conversation as resolved.
Show resolved
Hide resolved
|
||
id="device_type" | ||
label="Device Type" | ||
name="" | ||
// options={} | ||
// value={} | ||
/> | ||
</div> | ||
<div className="flex w-1/2 flex-col px-2"> | ||
<CustomInputText | ||
id="model" | ||
label="Model" | ||
name="" | ||
type="text" | ||
value="" | ||
// onChange={} | ||
/> | ||
</div> | ||
</div> | ||
<div className="flex flex-row py-3"> | ||
<div className="flex w-1/2 flex-col px-2"> | ||
<CustomInputText | ||
id="" | ||
label="Serial Number" | ||
name="" | ||
type="text" | ||
value="" | ||
// onChange={} | ||
/> | ||
</div> | ||
<div className="flex w-1/2 flex-col px-2"> | ||
<CustomInputText | ||
id="" | ||
label="Memory" | ||
name="" | ||
type="text" | ||
value="" | ||
// onChange={} | ||
/> | ||
</div> | ||
</div> | ||
<div className="flex flex-row py-3"> | ||
<div className="flex w-1/2 flex-col"> | ||
<div className="field relative flex w-full flex-col px-2"> | ||
<CustomInputText | ||
id="" | ||
label="Graphics" | ||
name="" | ||
type="text" | ||
value="" | ||
/> | ||
</div> | ||
</div> | ||
<div className="flex w-1/2 flex-col"> | ||
<div className="field relative flex w-full flex-col px-2"> | ||
<CustomInputText | ||
id="" | ||
label="Processor" | ||
name="" | ||
type="text" | ||
value="" | ||
/> | ||
</div> | ||
</div> | ||
</div> | ||
<div className="mt-10 flex w-full items-center justify-between"> | ||
<Button className="mx-2 w-full rounded border border-dashed border-miru-dark-purple-200 bg-white py-3 text-center text-base font-bold tracking-widest text-miru-dark-purple-200"> | ||
+ Add Another Device | ||
</Button> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
export default EditPage; |
51 changes: 51 additions & 0 deletions
51
app/javascript/src/components/Profile/UserDetail/AllocatedDevicesDetails/Edit/index.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* eslint-disable no-unused-vars */ | ||
import React, { Fragment, useState } from "react"; | ||
|
||
import dayjs from "dayjs"; | ||
import utc from "dayjs/plugin/utc"; | ||
import { useNavigate } from "react-router-dom"; | ||
|
||
import Loader from "common/Loader/index"; | ||
import { useUserContext } from "context/UserContext"; | ||
|
||
import EditPage from "./EditPage"; | ||
|
||
dayjs.extend(utc); | ||
|
||
const AllocatedDevicesEdit = () => { | ||
const navigate = useNavigate(); | ||
const { isDesktop } = useUserContext(); | ||
|
||
const [isLoading, setIsLoading] = useState(false); | ||
|
||
const handleCancelDetails = () => { | ||
setIsLoading(true); | ||
navigate(`/settings/devices`, { replace: true }); | ||
}; | ||
|
||
return ( | ||
<Fragment> | ||
{isDesktop && ( | ||
<Fragment> | ||
<div className="flex items-center justify-between bg-miru-han-purple-1000 px-10 py-4"> | ||
<h1 className="text-2xl font-bold text-white">Allocated Devices</h1> | ||
<div> | ||
<button | ||
className="mx-1 cursor-pointer rounded-md border border-white bg-miru-han-purple-1000 px-3 py-2 font-bold text-white " | ||
onClick={handleCancelDetails} | ||
> | ||
Cancel | ||
</button> | ||
<button className="mx-1 cursor-pointer rounded-md border bg-white px-3 py-2 font-bold text-miru-han-purple-1000"> | ||
Update | ||
</button> | ||
</div> | ||
</div> | ||
{isLoading ? <Loader className="min-h-70v" /> : <EditPage />} | ||
</Fragment> | ||
)} | ||
</Fragment> | ||
); | ||
}; | ||
|
||
export default AllocatedDevicesEdit; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why the
primary
value is removed?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because it was applying primary style to the buttons where it is not needed.
for example in some places we are using
<Button>
component with it's own modified CSS but if we pass primary as a default value, it's combing the primary css style with modified css.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By default, the primary style is needed. Update the Button component to overwrite the primary styles with the modified css from the importing component. Please check the Miru docs of the Button component https://docs.miru.so/contributing-guide/component-library/button
What I mean is whenever someone imports the Button component, then by default primary style should be loaded without passing any style prop