Skip to content
Open
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
33 changes: 33 additions & 0 deletions packages/app/src/app/components/Create/ImportRepository.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { ModalContentProps } from 'app/pages/common/Modals';
import { SignIn } from 'app/pages/SignIn/SignIn';
import { useAppState, useEffects } from 'app/overmind';
import { useGitHubPermissions } from 'app/hooks/useGitHubPermissions';
import { useWorkspaceFeatureFlags } from 'app/hooks/useWorkspaceFeatureFlags';
import { GithubRepoAuthorization } from 'app/graphql/types';
import { useGithubAccounts } from 'app/hooks/useGithubOrganizations';
import {
Expand Down Expand Up @@ -43,6 +44,7 @@ export const ImportRepository: React.FC<
> = ({ preSelectedRepo }) => {
const { hasLogIn } = useAppState();
const effects = useEffects();
const { blockRepoImport } = useWorkspaceFeatureFlags();
const {
restrictsPublicRepos,
restrictsPrivateRepos,
Expand Down Expand Up @@ -140,6 +142,37 @@ export const ImportRepository: React.FC<

const forkMode = selectedRepo?.authorization === GithubRepoAuthorization.Read;

if (blockRepoImport) {
return (
<ThemeProvider>
<Container>
<ModalBody>
<Stack
direction="vertical"
gap={4}
align="center"
justify="center"
css={{ width: '100%', padding: '24px', textAlign: 'center' }}
>
<Text size={4}>Repository import is deprecated</Text>
<Text size={3} css={{ color: '#999', maxWidth: '400px' }}>
Importing repositories is no longer supported.{' '}
<a
href="https://codesandbox.io/docs/learn/repositories/migration-guide"
target="_blank"
rel="noreferrer noopener"
style={{ color: '#E4FC82' }}
>
Learn more in our documentation.
</a>
</Text>
</Stack>
</ModalBody>
</Container>
</ThemeProvider>
);
}

return (
<ThemeProvider>
<Container>
Expand Down
6 changes: 6 additions & 0 deletions packages/app/src/app/graphql/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,7 @@ export enum Direction {

export type TeamFeatureFlags = {
__typename?: 'TeamFeatureFlags';
blockRepoImport: Scalars['Boolean'];
friendOfCsb: Scalars['Boolean'];
ubbBeta: Scalars['Boolean'];
};
Expand Down Expand Up @@ -3571,6 +3572,7 @@ export type TeamFragmentDashboardFragment = {
} | null;
featureFlags: {
__typename?: 'TeamFeatureFlags';
blockRepoImport: boolean;
ubbBeta: boolean;
friendOfCsb: boolean;
};
Expand Down Expand Up @@ -3693,6 +3695,7 @@ export type CurrentTeamInfoFragmentFragment = {
};
featureFlags: {
__typename?: 'TeamFeatureFlags';
blockRepoImport: boolean;
ubbBeta: boolean;
friendOfCsb: boolean;
};
Expand Down Expand Up @@ -3866,6 +3869,7 @@ export type _CreateTeamMutation = {
} | null;
featureFlags: {
__typename?: 'TeamFeatureFlags';
blockRepoImport: boolean;
ubbBeta: boolean;
friendOfCsb: boolean;
};
Expand Down Expand Up @@ -4723,6 +4727,7 @@ export type AllTeamsQuery = {
} | null;
featureFlags: {
__typename?: 'TeamFeatureFlags';
blockRepoImport: boolean;
ubbBeta: boolean;
friendOfCsb: boolean;
};
Expand Down Expand Up @@ -5172,6 +5177,7 @@ export type GetTeamQuery = {
};
featureFlags: {
__typename?: 'TeamFeatureFlags';
blockRepoImport: boolean;
ubbBeta: boolean;
friendOfCsb: boolean;
};
Expand Down
3 changes: 3 additions & 0 deletions packages/app/src/app/hooks/useWorkspaceFeatureFlags.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useAppState } from 'app/overmind';

export type FeatureFlags = {
blockRepoImport: boolean;
ubbBeta: boolean;
friendOfCsb: boolean;
};
Expand All @@ -10,12 +11,14 @@ export const useWorkspaceFeatureFlags = (): FeatureFlags => {

if (!activeTeamInfo) {
return {
blockRepoImport: false,
ubbBeta: false,
friendOfCsb: false,
};
}

return {
blockRepoImport: activeTeamInfo.featureFlags.blockRepoImport,
ubbBeta: activeTeamInfo.featureFlags.ubbBeta,
friendOfCsb: activeTeamInfo.featureFlags.friendOfCsb,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ export const teamFragmentDashboard = gql`
}

featureFlags {
blockRepoImport
ubbBeta
friendOfCsb
}
Expand Down Expand Up @@ -277,6 +278,7 @@ export const currentTeamInfoFragment = gql`
}

featureFlags {
blockRepoImport
ubbBeta
friendOfCsb
}
Expand Down