Skip to content

Commit

Permalink
Edit Home.jsx indentation
Browse files Browse the repository at this point in the history
Signed-off-by: Han Kyuhyun <[email protected]>
Co-authored-by: ByunJeongHeum <[email protected]>
Co-authored-by: June Saehwan <[email protected]>
Co-authored-by: jongmin Lee <[email protected]>
  • Loading branch information
4 people committed Sep 24, 2023
1 parent 066fb0e commit 67858fb
Showing 1 changed file with 104 additions and 114 deletions.
218 changes: 104 additions & 114 deletions frontend/src/pages/Home.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,128 +11,118 @@ import { Link } from "react-router-dom";
import "../css/Home_style.css";

export const LPVS_SERVER = process.env.REACT_APP_LPVS_SERVER;

export const Home = () => {
const [isLoggedIn, setIsLoggedIn] = useState(false);
const [username, setUsername] = useState("");
const [isLoggedIn, setIsLoggedIn] = useState(false);
const [username, setUsername] = useState("");

useEffect(() => {
axios.get("/login/check")
.then((loginresponse) => {
if (loginresponse.data.isLoggedIn) {
setIsLoggedIn(loginresponse.data.isLoggedIn);
axios.get("/user/info").then((userInfoResponse) => {
setUsername(userInfoResponse.data);
});
}
})
.catch(function(error) {
console.log(error.toJSON());
});
}, []);
useEffect(() => {
axios.get("/login/check")
.then((loginresponse) => {
if (loginresponse.data.isLoggedIn) {
setIsLoggedIn(loginresponse.data.isLoggedIn);
axios.get("/user/info").then((userInfoResponse) => {
setUsername(userInfoResponse.data);
});
}
})
.catch(function(error) {
console.log(error.toJSON());
});
}, []);

function truncateName(name) {
if (/[\u3131-\u314e\u314f-\u3163\uac00-\ud7a3]/g.test(name)) {
return name.length > 3 ? `${name.substring(0, 3)}.` : name;
} else {
return name.length > 5 ? `${name.substring(0, 5)}.` : name;
function truncateName(name) {
if (/[\u3131-\u314e\u314f-\u3163\uac00-\ud7a3]/g.test(name)) {
return name.length > 3 ? `${name.substring(0, 3)}.` : name;
} else {
return name.length > 5 ? `${name.substring(0, 5)}.` : name;
}
}
}

return (
<div className="home">
<div className="div">
<div className="LPVS-info">
<div className="overlap-group">
<div className="user-guide">
<p>Welcome to the License Pre-Validation Service (LPVS).</p>
<h3>Usage Procedure</h3>
<ol>
<li>Sign up and Login to the service.</li>
<li>Go to user information page, enter your GitHub ID (required) and Organization Name (optional), then click the "Admit" button.</li>
<li>Login to GitHub using the GitHub ID you entered in step 2.</li>
<li>To configure the repository for license validation, follow these steps:</li>
<ol type="a">
<li>Go to the repository you want to validation.</li>
<li>Navigate to Settings -{">"} Webhooks -{">"} Add Webhooks.</li>
<li>Enter 'http://{"<"}IP where LPVS is running:7896/webhooks{">"}' in the Payload URL field.</li>
<li>Select 'application/json' for Content Type.</li>
<li>Enter 'LPVS' in the Secret field.</li>
<li>Under "Which events would you like to trigger this webhook?", select 'Let me select individual events.' and check only the 'Pull Request' option.</li>
<li>Click the green 'Add webhook' button.</li>
</ol>
<li>After completing the webhook setup for the repository, create a Pull Request on that repository to see the results of license validation.</li>
</ol>
<h3>Important Notes</h3>
<ul>
<li>If you enter a GitHub ID that is already used by someone else in your user information, it will not be reflected.</li>
<li>This service is only available for Public Repository.</li>
<li>Webhook settings are mandatory for using this service.</li>
</ul>
</div>
</div>
</div>
<div className="LPVS-logo">
<a href="https://github.com/Samsung/LPVS">
<img className="LPVS-github" alt="img" src="/image/png/LPVSLogo.png" />
</a>
<div className="license-explain">
License <br />
Pre <br />
Validation <br />
Service
</div>
<div className="text-wrapper-2">About</div>
</div>
<div className="menubar-top">
<div className="menu-line" />
<div className="menu">
<div className="overlap">
{isLoggedIn ? (
<div className="profile-border" />
): null} <div className="profile">
<div className="overlap-group-2">
<img className="image" alt="img" src="/image/png/ProfileImg.png" />
<div className="text-wrapper-3">
{isLoggedIn ? (
<span style={{ color: "black", textDecoration: "none" }}>
<Link
to={"/user/setting"}
style={{ color: "black", textDecoration: "none" }}
>
{username?.name ? (
<div>{truncateName(username.name)}</div>
) : (
<div>Loading...</div>
)}
</Link>
</span>
) : (
<Link
to={"/login"}
style={{ color: "black", textDecoration: "none" }}
>
Login
</Link>
)}
</div>
return (
<div className="home">
<div className="div">
<div className="LPVS-info">
<div className="overlap-group">
<div className="user-guide">
<p>Welcome to the License Pre-Validation Service (LPVS).</p>
<h3>Usage Procedure</h3>
<ol>
<li>Sign up and Login to the service.</li>
<li>Go to user information page, enter your GitHub ID (required) and Organization Name (optional), then click the "Admit" button.</li>
<li>Login to GitHub using the GitHub ID you entered in step 2.</li>
<li>To configure the repository for license validation, follow these steps:</li>
<ol type="a">
<li>Go to the repository you want to validation.</li>
<li>Navigate to Settings -{">"} Webhooks -{">"} Add Webhooks.</li>
<li>Enter 'http://{"<"}IP where LPVS is running:7896/webhooks{">"}' in the Payload URL field.</li>
<li>Select 'application/json' for Content Type.</li>
<li>Enter 'LPVS' in the Secret field.</li>
<li>Under "Which events would you like to trigger this webhook?", select 'Let me select individual events.' and check only the 'Pull Request' option.</li>
<li>Click the green 'Add webhook' button.</li>
</ol>
<li>After completing the webhook setup for the repository, create a Pull Request on that repository to see the results of license validation.</li>
</ol>
<h3>Important Notes</h3>
<ul>
<li>If you enter a GitHub ID that is already used by someone else in your user information, it will not be reflected.</li>
<li>This service is only available for Public Repository.</li>
<li>Webhook settings are mandatory for using this service.</li>
</ul>
</div>
</div>
</div>
<div className="LPVS-logo">
<a href="https://github.com/Samsung/LPVS">
<img className="LPVS-github" alt="img" src="/image/png/LPVSLogo.png" />
</a>
<div className="license-explain">
License <br />
Pre <br />
Validation <br />
Service
</div>
<div className="text-wrapper-2">About</div>
</div>
<div className="menubar-top">
<div className="menu-line" />
<div className="menu">
<div className="overlap">
{isLoggedIn ? <div className="profile-border" /> : null}
<div className="profile">
<div className="overlap-group-2">
<img className="image" alt="img" src="/image/png/ProfileImg.png" />
<div className="text-wrapper-3">
{isLoggedIn ? (
<span style={{ color: "black", textDecoration: "none" }}>
<Link to={"/user/setting"} style={{ color: "black", textDecoration: "none" }}>
{username?.name ? <div>{truncateName(username.name)}</div> : <div>Loading...</div>}
</Link>
</span>
) : (
<Link to={"/login"} style={{ color: "black", textDecoration: "none" }}>
Login
</Link>
)}
</div>
</div>
</div>
</div>
<div className="text-wrapper-7">
{isLoggedIn ? (
<Link to={`/history/send/${username?.nickname}?page=0`} style={{ color: "black", textDecoration: "none" }}>
History
</Link>
) : null}
</div>
</div>
<Link to={"/home"} style={{ color: "black", textDecoration: "none"}}>
<img className="LPVS" alt="img" src="/image/png/LPVS_logo_bar.png" />
</Link>
</div>
</div>
</div>
<div className="text-wrapper-7">
{isLoggedIn ? (
<Link to={`/history/send/${username?.nickname}?page=0`} style={{ color: "black", textDecoration: "none" }}>
History
</Link>
) : null}
</div>
</div>
<Link to={"/home"} style={{ color: "black", textDecoration: "none"}}>
<img className="LPVS" alt="img" src="/image/png/LPVS_logo_bar.png" />
</Link>
</div>
</div>
</div>
);
);
};

export default Home;

0 comments on commit 67858fb

Please sign in to comment.