Skip to content

Commit

Permalink
fix page redirection issue
Browse files Browse the repository at this point in the history
fix page redirection issue

fix page redirection issue

fix page redirection issue

fix page redirection issue
  • Loading branch information
tsirysndr committed Jul 4, 2024
1 parent 1ef6bd8 commit 45eec4f
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 18 deletions.
4 changes: 3 additions & 1 deletion webui/src/Components/Header/HeaderWithData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ const HeaderWithData: FC<HeaderWithDataProps> = () => {

const isOwner =
(project?.owner === me?.github && project?.owner) ||
!import.meta.env.VITE_APP_API_URL?.includes("api.fluentci.io");
(!import.meta.env.VITE_APP_API_URL?.includes("api.fluentci.io") &&
location.hostname !== "app.fluentci.io");

const breadcrumbs: { title: string; link?: string }[] = [
{
Expand Down Expand Up @@ -167,6 +168,7 @@ const HeaderWithData: FC<HeaderWithDataProps> = () => {
breadcrumbs={breadcrumbs}
showRunButton={
(!import.meta.env.VITE_APP_API_URL?.includes("api.fluentci.io") &&
location.hostname !== "app.fluentci.io" &&
project?.path !== "empty" &&
!!actions?.filter((x) => x.enabled).length) ||
(me?.github === project?.owner &&
Expand Down
16 changes: 11 additions & 5 deletions webui/src/Components/Navbar/NavbarWithData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,13 @@ const NavbarWithData: FC = () => {
}

if (!user && location.host === "app.fluentci.io") {
navigate("/auth");
return;
if (
location.pathname.startsWith("/settings") ||
location.pathname.startsWith("/link-project")
) {
navigate("/auth");
return;
}
}

user &&
Expand All @@ -43,9 +48,10 @@ const NavbarWithData: FC = () => {
user={user}
onSignOut={onSignOut}
showAccountMenu={!!me}
showSignInButton={import.meta.env.VITE_APP_API_URL?.includes(
"api.fluentci.io"
)}
showSignInButton={
import.meta.env.VITE_APP_API_URL?.includes("api.fluentci.io") ||
location.hostname === "app.fluentci.io"
}
/>
);
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ const MainContentWithData: FC = () => {
projects={data?.projects}
onNewProject={onNewProject}
displayNewProjectButton={
!import.meta.env.VITE_APP_API_URL?.includes("api.fluentci.io") ||
(!import.meta.env.VITE_APP_API_URL?.includes("api.fluentci.io") &&
location.hostname !== "app.fluentci.io") ||
(me?.github === usernameOrOrg && !!usernameOrOrg) ||
(!!me && !usernameOrOrg)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,8 @@ const ActionWithData: FC<ActionWithDataProps> = (props) => {
disabled={
project?.archived === true ||
(me?.github !== project?.owner &&
import.meta.env.VITE_APP_API_URL?.includes("api.fluentci.io"))
(import.meta.env.VITE_APP_API_URL?.includes("api.fluentci.io") ||
location.hostname === "app.fluentci.io"))
}
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,8 @@ const SetupActionModalWithData: FC<SetupActionModalWithDataProps> = (props) => {
disabled={
project?.archived === true ||
(me?.github !== project?.owner &&
import.meta.env.VITE_APP_API_URL?.includes("api.fluentci.io"))
(import.meta.env.VITE_APP_API_URL?.includes("api.fluentci.io") ||
location.hostname === "app.fluentci.io"))
}
/>
</FormProvider>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,10 @@ const DangerZoneWithData: FC = () => {

return (
<DangerZone
displayRepositorySection={import.meta.env.VITE_APP_API_URL?.includes(
"api.fluentci.io"
)}
displayRepositorySection={
import.meta.env.VITE_APP_API_URL?.includes("api.fluentci.io") ||
location.hostname === "app.fluentci.io"
}
isPublic={project?.isPrivate !== true}
isArchived={project?.archived === true}
onChangeVisibility={onChangeVisibility}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,10 @@ const RepositoryWithData: FC = () => {
loadingLinkedRepository={loadingLinkedRepository}
projectId={project?.id}
orgs={organizationsData?.organizations || []}
displayRepositorySection={import.meta.env.VITE_APP_API_URL?.includes(
"api.fluentci.io"
)}
displayRepositorySection={
import.meta.env.VITE_APP_API_URL?.includes("api.fluentci.io") ||
location.hostname === "app.fluentci.io"
}
loadingUnlink={loadingUnlink}
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import Repository from "./Repository";
import DangerZone from "./DangerZone";

const Settings: FC = () => {
const displayRepositorySection = import.meta.env.VITE_APP_API_URL?.includes(
"api.fluentci.io"
);
const displayRepositorySection =
import.meta.env.VITE_APP_API_URL?.includes("api.fluentci.io") ||
location.hostname === "app.fluentci.io";
return (
<>
<General />
Expand Down

0 comments on commit 45eec4f

Please sign in to comment.