Skip to content

Commit 8207839

Browse files
Use a slightly different copy for developers without any apps
1 parent 8c87534 commit 8207839

File tree

2 files changed

+32
-3
lines changed

2 files changed

+32
-3
lines changed

portal/src/graphql/portal/CreateProjectScreen.tsx

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,13 @@ import { FormattedMessage, Context } from "@oursky/react-messageformat";
55
import WizardScreenLayout from "../../WizardScreenLayout";
66
import WizardContentLayout from "../../WizardContentLayout";
77
import FormTextField from "../../FormTextField";
8+
import ShowError from "../../ShowError";
9+
import ShowLoading from "../../ShowLoading";
810
import { FormErrorMessageBar } from "../../FormErrorMessageBar";
911
import { FormProvider } from "../../form";
1012
import { useSystemConfig } from "../../context/SystemConfigContext";
1113
import { useCreateAppMutation } from "./mutations/createAppMutation";
14+
import { useAppListQuery } from "./query/appListQuery";
1215
import { ErrorParseRule, makeReasonErrorParseRule } from "../../error/parse";
1316
import { useSimpleForm } from "../../hook/useSimpleForm";
1417

@@ -45,7 +48,12 @@ const errorRules: ErrorParseRule[] = [
4548
),
4649
];
4750

48-
const CreateProjectScreen: React.FC = function CreateProjectScreen() {
51+
interface CreateProjectScreenContentProps {
52+
numberOfApps: number;
53+
}
54+
55+
function CreateProjectScreenContent(props: CreateProjectScreenContentProps) {
56+
const { numberOfApps } = props;
4957
const navigate = useNavigate();
5058
const { appHostSuffix } = useSystemConfig();
5159
const { createApp } = useCreateAppMutation();
@@ -103,7 +111,14 @@ const CreateProjectScreen: React.FC = function CreateProjectScreen() {
103111
<WizardScreenLayout>
104112
<FormErrorMessageBar />
105113
<WizardContentLayout
106-
title={<FormattedMessage id="CreateProjectScreen.title" />}
114+
title={
115+
<FormattedMessage
116+
id="CreateProjectScreen.title"
117+
values={{
118+
apps: numberOfApps,
119+
}}
120+
/>
121+
}
107122
backButtonDisabled={true}
108123
primaryButton={
109124
<PrimaryButton onClick={onSubmitForm}>
@@ -131,6 +146,20 @@ const CreateProjectScreen: React.FC = function CreateProjectScreen() {
131146
</WizardScreenLayout>
132147
</FormProvider>
133148
);
149+
}
150+
151+
const CreateProjectScreen: React.FC = function CreateProjectScreen() {
152+
const { loading, error, apps, refetch } = useAppListQuery();
153+
154+
if (loading) {
155+
return <ShowLoading />;
156+
}
157+
158+
if (error != null) {
159+
return <ShowError error={error} onRetry={refetch} />;
160+
}
161+
162+
return <CreateProjectScreenContent numberOfApps={apps?.length ?? 0} />;
134163
};
135164

136165
export default CreateProjectScreen;

portal/src/locale-data/en.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1016,7 +1016,7 @@
10161016

10171017
"WizardContentLayout.skip.label": "Skip and I’ll set up my project manually",
10181018

1019-
"CreateProjectScreen.title": "Create your first project",
1019+
"CreateProjectScreen.title": "{apps, plural, =0{Create your first project} other{Create a new project}}",
10201020
"CreateProjectScreen.create-project.label": "Create Project",
10211021
"CreateProjectScreen.app-id.label": "What is the name of your project?",
10221022
"CreateProjectScreen.app-id.description": "This is your Authgear endpoint for your applications. Once chosen, the project cannot be renamed.",

0 commit comments

Comments
 (0)