This commit is contained in:
Manav Rathi
2024-09-11 08:56:21 +05:30
parent 30901462bc
commit 0d079fc593
2 changed files with 12 additions and 15 deletions

View File

@@ -1,3 +1,4 @@
import { assertionFailed } from "@/base/assert";
import { useIsMobileWidth } from "@/base/hooks";
import { FileType } from "@/media/file-type";
import { PeopleList } from "@/new/photos/components/PeopleList";
@@ -425,11 +426,13 @@ interface EmptyStateProps {
* The view shown in the menu area when the user has not typed anything in the
* search box.
*/
const EmptyState: React.FC<EmptyStateProps> = (props) => {
const status = isMLSupported && mlStatusSnapshot();
const EmptyState: React.FC<EmptyStateProps> = () => {
const status = mlStatusSnapshot();
if (!isMLSupported) return null;
if (!status || status.phase == "disabled") return null;
if (!status || status.phase == "disabled") {
assertionFailed();
return <></>;
}
let label: string;
switch (status.phase) {
@@ -502,18 +505,8 @@ const EmptyState: React.FC<EmptyStateProps> = (props) => {
// {props.children}
// </SelectComponents.Menu>
// );
return <></>;
return (
<div>
<h1>Hello</h1>
<p>{(console.log(props), props.toString())}</p>
</div>
);
};
export async function getMLStatusSuggestion(): Promise<Suggestion> {}
const Option: React.FC<OptionProps<SearchOption, false>> = (props) => (
<SelectComponents.Option {...props}>
<LabelWithInfo data={props.data} />

View File

@@ -4,8 +4,12 @@ import log from "./log";
/**
* If running in a dev build, throw an exception with the given message.
* Otherwise log it as a warning.
*
* @param message An optional message to use for the failure. If not provided,
* then a generic one is used.
*/
export const assertionFailed = (message: string) => {
export const assertionFailed = (message?: string) => {
message = message ?? "Assertion failed";
if (isDevBuild) throw new Error(message);
log.warn(message);
};