Skip to content

Commit

Permalink
more copy and linting
Browse files Browse the repository at this point in the history
  • Loading branch information
Mary Hipp authored and Mary Hipp committed Oct 11, 2024
1 parent c694668 commit 09c116e
Show file tree
Hide file tree
Showing 6 changed files with 133 additions and 78 deletions.
6 changes: 5 additions & 1 deletion invokeai/frontend/web/public/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -780,6 +780,7 @@
"source": "Source",
"spandrelImageToImage": "Image to Image (Spandrel)",
"starterBundles": "Starter Bundles",
"starterBundleHelpText": "Easily install all models needed to get started with a base model, including a main model, controlnets, IP adapters, and more. Selecting a bundle will skip any models that you already have installed.",
"starterModels": "Starter Models",
"starterModelsInModelManager": "Starter Models can be found in Model Manager",
"syncModels": "Sync Models",
Expand Down Expand Up @@ -1990,7 +1991,10 @@
},
"newUserExperience": {
"toGetStarted": "To get started, make sure to download or import models needed to run Invoke. Then, enter a prompt in the box and click <StrongComponent>Invoke</StrongComponent> to generate your first image. Select a prompt template to improve results. You can choose to save your images directly to the <StrongComponent>Gallery</StrongComponent> or edit them to the <StrongComponent>Canvas</StrongComponent>.",
"gettingStartedSeries": "Want more guidance? Check out our <LinkComponent>Getting Started Series</LinkComponent> for tips on unlocking the full potential of the Invoke Studio."
"gettingStartedSeries": "Want more guidance? Check out our <LinkComponent>Getting Started Series</LinkComponent> for tips on unlocking the full potential of the Invoke Studio.",
"downloadStarterModels": "Download Starter Models",
"importModels": "Import Models",
"noModelsInstalled": "It looks like you don't have any models installed"
},
"whatsNew": {
"whatsNewInInvoke": "What's New in Invoke",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,28 @@
import { Flex, Spinner, Text } from '@invoke-ai/ui-library';
import { Button, Divider, Flex, Spinner, Text } from '@invoke-ai/ui-library';
import { useAppDispatch } from 'app/store/storeHooks';
import { IAINoContentFallback } from 'common/components/IAIImageFallback';
import { InvokeLogoIcon } from 'common/components/InvokeLogoIcon';
import { LOADING_SYMBOL, useHasImages } from 'features/gallery/hooks/useHasImages';
import { $installModelsTab } from 'features/modelManagerV2/subpanels/InstallModels';
import { setActiveTab } from 'features/ui/store/uiSlice';
import { useCallback } from 'react';
import { Trans, useTranslation } from 'react-i18next';
import { PiImageBold } from 'react-icons/pi';

export const NoContentForViewer = () => {
const hasImages = useHasImages();
const { t } = useTranslation();
const dispatch = useAppDispatch()

const handleClickDownloadStarterModels= useCallback(() => {
dispatch(setActiveTab('models'));
$installModelsTab.set(3);
}, [dispatch])

const handleClickImportModels= useCallback(() => {
dispatch(setActiveTab('models'));
$installModelsTab.set(0);
}, [dispatch])

if (hasImages === LOADING_SYMBOL) {
return (
Expand All @@ -28,32 +43,47 @@ export const NoContentForViewer = () => {
return (
<Flex flexDir="column" gap={4} alignItems="center" textAlign="center" maxW="600px">
<InvokeLogoIcon w={40} h={40} />
<Text fontSize="md" color="base.200" pt={16}>
<Trans
i18nKey="newUserExperience.toGetStarted"
components={{
StrongComponent: <Text as="span" color="white" fontSize="md" fontWeight="semibold" />,
}}
/>
</Text>

<Text fontSize="md" color="base.200">
<Trans
i18nKey="newUserExperience.gettingStartedSeries"
components={{
LinkComponent: (
<Text
as="a"
color="white"
fontSize="md"
fontWeight="semibold"
href="https://www.youtube.com/playlist?list=PLvWK1Kc8iXGrQy8r9TYg6QdUuJ5MMx-ZO"
target="_blank"
/>
),
}}
/>
</Text>
<Flex flexDir="column" gap={8} alignItems="center" textAlign="center">
<Text fontSize="md" color="base.200" pt={16}>
<Trans
i18nKey="newUserExperience.toGetStarted"
components={{
StrongComponent: <Text as="span" color="white" fontSize="md" fontWeight="semibold" />,
}}
/>
</Text>

<Flex flexDir="column" gap={2} alignItems="center">
<Text fontSize="md" color="base.200">
{t("newUserExperience.noModelsInstalled")}
</Text>
<Flex gap={3} alignItems="center">
<Button size="sm" onClick={handleClickDownloadStarterModels}>{t('newUserExperience.downloadStarterModels')}</Button>
<Text fontSize="sm" color="base.200">{t("common.or")}</Text>
<Button size="sm" onClick={handleClickImportModels}>{t('newUserExperience.importModels')}</Button>
</Flex>
</Flex>

<Divider />

<Text fontSize="md" color="base.200">
<Trans
i18nKey="newUserExperience.gettingStartedSeries"
components={{
LinkComponent: (
<Text
as="a"
color="white"
fontSize="md"
fontWeight="semibold"
href="https://www.youtube.com/playlist?list=PLvWK1Kc8iXGrQy8r9TYg6QdUuJ5MMx-ZO"
target="_blank"
/>
),
}}
/>
</Text>
</Flex>
</Flex>
);
};
Original file line number Diff line number Diff line change
@@ -1,40 +1,40 @@
import { EMPTY_ARRAY } from "app/store/constants";
import { useCallback,useMemo } from "react";
import { modelConfigsAdapterSelectors,useGetModelConfigsQuery } from "services/api/endpoints/models";
import type { StarterModel } from "services/api/types";
import { EMPTY_ARRAY } from 'app/store/constants';
import { useCallback, useMemo } from 'react';
import { modelConfigsAdapterSelectors, useGetModelConfigsQuery } from 'services/api/endpoints/models';
import type { StarterModel } from 'services/api/types';

export const useBuildModelsToInstall = () => {
const { data: modelListRes } = useGetModelConfigsQuery();
const modelList = useMemo(() => {
if (!modelListRes) {
return EMPTY_ARRAY;
}
const { data: modelListRes } = useGetModelConfigsQuery();
const modelList = useMemo(() => {
if (!modelListRes) {
return EMPTY_ARRAY;
}

return modelConfigsAdapterSelectors.selectAll(modelListRes);
}, [modelListRes]);
return modelConfigsAdapterSelectors.selectAll(modelListRes);
}, [modelListRes]);

const buildModelToInstall = useCallback(
(starterModel: StarterModel) => {
if (
modelList.some(
(mc) => starterModel.base === mc.base && starterModel.name === mc.name && starterModel.type === mc.type
)
) {
return undefined;
}
const buildModelToInstall = useCallback(
(starterModel: StarterModel) => {
if (
modelList.some(
(mc) => starterModel.base === mc.base && starterModel.name === mc.name && starterModel.type === mc.type
)
) {
return undefined;
}

const source = starterModel.source;
const config = {
name: starterModel.name,
description: starterModel.description,
type: starterModel.type,
base: starterModel.base,
format: starterModel.format,
};
return { config, source };
},
[modelList]
);
const source = starterModel.source;
const config = {
name: starterModel.name,
description: starterModel.description,
type: starterModel.type,
base: starterModel.base,
format: starterModel.format,
};
return { config, source };
},
[modelList]
);

return buildModelToInstall
}
return buildModelToInstall;
};
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Button, Flex, Text, Tooltip } from '@invoke-ai/ui-library';
import { useBuildModelsToInstall } from 'features/modelManagerV2/hooks/useBuildModelsToInstall';
import { isMainModelBase } from 'features/nodes/types/common';
import { MODEL_TYPE_SHORT_MAP } from 'features/parameters/types/constants';
import { toast } from 'features/toast/toast';
import { useCallback, useMemo } from 'react';
import { Trans, useTranslation } from 'react-i18next';
import { useTranslation } from 'react-i18next';
import { type GetStarterModelsResponse, useInstallModelMutation } from 'services/api/endpoints/models';
import { isMainModelBase } from '../../../../nodes/types/common';

export const StarterBundle = ({
bundleName,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
import { Flex, IconButton, Input, InputGroup, InputRightElement, Text } from '@invoke-ai/ui-library';
import {
Box,
Flex,
Icon,
IconButton,
Input,
InputGroup,
InputRightElement,
Text,
Tooltip,
} from '@invoke-ai/ui-library';
import ScrollableContent from 'common/components/OverlayScrollbars/ScrollableContent';
import type { ChangeEventHandler } from 'react';
import { memo, useCallback, useMemo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { PiXBold } from 'react-icons/pi';
import { PiInfoBold, PiXBold } from 'react-icons/pi';
import type { GetStarterModelsResponse } from 'services/api/endpoints/models';

import { StarterBundle } from './StarterBundle';
Expand Down Expand Up @@ -47,17 +57,28 @@ export const StarterModelsResults = memo(({ results }: StarterModelsResultsProps
<Flex flexDir="column" gap={3} height="100%">
<Flex justifyContent="space-between" alignItems="center">
{!!Object.keys(results.starter_bundles).length && (
<Flex gap={2} alignItems="center">
<Text fontWeight="semibold">{t('modelManager.starterBundles')}:</Text>
{Object.keys(results.starter_bundles).map((bundleName) => (
<>
{results.starter_bundles[bundleName] ? (
<StarterBundle bundleName={bundleName} bundle={results.starter_bundles[bundleName]} />
) : (
<></>
)}
</>
))}
<Flex gap={4} alignItems="center">
<Flex gap={1} alignItems="center">
<Text color="base.200" fontWeight="semibold">
{t('modelManager.starterBundles')}
</Text>
<Tooltip label={t('modelManager.starterBundleHelpText')}>
<Box>
<Icon as={PiInfoBold} color="base.200" />
</Box>
</Tooltip>
</Flex>
<Flex gap={2}>
{Object.keys(results.starter_bundles).map((bundleName) => (
<>
{results.starter_bundles[bundleName] ? (
<StarterBundle bundleName={bundleName} bundle={results.starter_bundles[bundleName]} />
) : (
<></>
)}
</>
))}
</Flex>
</Flex>
)}
<InputGroup w={64} size="xs">
Expand Down
2 changes: 1 addition & 1 deletion invokeai/frontend/web/src/services/api/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,4 +242,4 @@ export type PostUploadAction =
| UpscaleInitialImageAction
| ReplaceLayerWithImagePostUploadAction;

export type StarterModel = S["StarterModel"]
export type StarterModel = S['StarterModel'];

0 comments on commit 09c116e

Please sign in to comment.