Skip to content

Commit

Permalink
Merge branch 'dev' into mainnet
Browse files Browse the repository at this point in the history
  • Loading branch information
serefyarar committed Jun 27, 2024
2 parents 2437db5 + cc06f72 commit cb7185b
Showing 1 changed file with 19 additions and 27 deletions.
46 changes: 19 additions & 27 deletions web-app/src/app/[...id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,15 @@ import IndexConversationSection from "components/sections/IndexConversation";
import UserConversationSection from "components/sections/UserConversation";
import "./app.css";
import { useEffect } from "react";
import { useAuth } from "@/context/AuthContext";
import { useAppSelector } from "@/store/store";
import { useAppDispatch, useAppSelector } from "@/store/store";
import { selectView } from "@/store/slices/appViewSlice";
import { selectIndex } from "@/store/slices/indexSlice";
import { selectConversation } from "@/store/slices/conversationSlice";
import { selectDID } from "@/store/slices/didSlice";
import { toggleUserIndex } from "@/store/api";

const Discovery = () => {
const { api: apiService, ready: apiReady } = useApi();
const { session } = useAuth();
const view = useAppSelector(selectView);
const index = useAppSelector(selectIndex);
const did = useAppSelector(selectDID);
const conversation = useAppSelector(selectConversation);

const dispatch = useAppDispatch();

useEffect(() => {
if (typeof window !== "undefined") {
Expand All @@ -34,34 +29,31 @@ const Discovery = () => {

useEffect(() => {
if (typeof window !== "undefined") {
if (!apiReady || !session) return;

if (!apiReady || !apiService) return;
const isFirstLogin = localStorage.getItem("isFirstLogin") === null;
const isMainnet =
process.env.NEXT_PUBLIC_API_URL === "https://index.network/api";

if (isFirstLogin) {
if (isMainnet && isFirstLogin) {
localStorage.setItem("isFirstLogin", "false");
} else {
return;
}

if (isMainnet) {
apiService?.starIndex(
const indexes = [
"kjzl6kcym7w8y6b1fncbo7p7h2v6tei9llby5ai9n7wj09oy1aeae7hqsc1io0j",
true,
);
apiService?.starIndex(
"kjzl6kcym7w8y63ksezbl4z1frr3xd0d9fg6nfmuwr1n0ue2xc4j7dtejvl4527",
true,
);
apiService?.starIndex(
"kjzl6kcym7w8y8lefkkbpl44q6jh1zu78gaq2zp18we4wdgz1tz9vxyx213ochh",
true,
);
];
indexes.forEach((indexID) => {
dispatch(
toggleUserIndex({
indexID,
api: apiService,
toggleType: "star",
value: true,
}),
);
});
}
}
}, [session, apiReady]);
}, [apiService, apiReady, dispatch]);

return (
<DiscoveryLayout>
Expand Down

0 comments on commit cb7185b

Please sign in to comment.