diff --git a/ui/src/components/AvatarWithPopup.vue b/ui/src/components/AvatarWithPopup.vue index dcd3e242..3056107f 100644 --- a/ui/src/components/AvatarWithPopup.vue +++ b/ui/src/components/AvatarWithPopup.vue @@ -2,7 +2,14 @@ ([]); const profileShowTimeouts = ref([]); const router = useRouter(); +const isCurrentProfile = (agentPubKey: HoloHashB64) => { + return router.currentRoute.value.params.agent === agentPubKey; +}; + const onAgentClick = (agentPubKey: HoloHashB64) => { - router.push(`/profiles/${agentPubKey}`); + if (!isCurrentProfile(agentPubKey)) { + router.push(`/profiles/${agentPubKey}`); + } }; const showProfile = (index: number) => { diff --git a/ui/src/components/MewList.vue b/ui/src/components/MewList.vue new file mode 100644 index 00000000..b923bf1e --- /dev/null +++ b/ui/src/components/MewList.vue @@ -0,0 +1,33 @@ + + + diff --git a/ui/src/components/FeedItem.vue b/ui/src/components/MewListItem.vue similarity index 89% rename from ui/src/components/FeedItem.vue rename to ui/src/components/MewListItem.vue index 63e9d260..0db2eb76 100644 --- a/ui/src/components/FeedItem.vue +++ b/ui/src/components/MewListItem.vue @@ -59,7 +59,7 @@ diff --git a/ui/src/components/FeedItemSkeleton.vue b/ui/src/components/MewListSkeleton.vue similarity index 100% rename from ui/src/components/FeedItemSkeleton.vue rename to ui/src/components/MewListSkeleton.vue diff --git a/ui/src/components/ProfilePopup.vue b/ui/src/components/ProfilePopup.vue index d225e2ee..3daf2297 100644 --- a/ui/src/components/ProfilePopup.vue +++ b/ui/src/components/ProfilePopup.vue @@ -5,7 +5,7 @@ @@ -50,6 +50,9 @@ const props = defineProps({ const isMyProfile = computed( () => props.agentPubKey === profileStore.myAgentPubKey ); +const isCurrentProfile = computed( + () => router.currentRoute.value.params.agent === props.agentPubKey +); const nickname = ref(""); const displayName = ref(""); @@ -75,6 +78,8 @@ onMounted(async () => { }); const onAgentClick = (agentPubKey: HoloHashB64) => { - router.push(`/profiles/${agentPubKey}`); + if (!isCurrentProfile.value) { + router.push(`/profiles/${agentPubKey}`); + } }; diff --git a/ui/src/pages/AgentProfile.vue b/ui/src/pages/AgentProfile.vue index aa28ceb5..1894eb6a 100644 --- a/ui/src/pages/AgentProfile.vue +++ b/ui/src/pages/AgentProfile.vue @@ -1,51 +1,40 @@ @@ -57,28 +46,39 @@ import { computed, onMounted, ref, watch } from "vue"; import { mewsBy, myFollowing } from "@/services/clutter-dna"; import { FeedMew } from "@/types/types"; import ButtonFollow from "@/components/ButtonFollow.vue"; -import MewContent from "@/components/MewContent.vue"; +import MewList from "../components/MewList.vue"; const profileStore = useProfileStore(); const route = useRoute(); const agentPubKey = computed(() => Array.isArray(route.params.agent) ? route.params.agent[0] : route.params.agent ); -const loading = ref(false); +const loadingMews = ref(false); +const loadingProfile = ref(false); const nickname = ref(""); const displayName = ref(""); const bio = ref(""); const location = ref(""); const following = ref(false); -const mewsFeed = ref([]); +const mews = ref([]); + +const loadMews = async () => { + try { + loadingMews.value = true; + mews.value = await mewsBy(agentPubKey.value); + } catch (error) { + showError(error); + } finally { + loadingMews.value = false; + } +}; const loadProfile = async () => { try { - loading.value = true; - const [profile, currentMyFollowing, mews] = await Promise.all([ + loadingProfile.value = true; + const [profile, currentMyFollowing] = await Promise.all([ profileStore.fetchAgentProfile(agentPubKey.value), myFollowing(), - mewsBy(agentPubKey.value), ]); if (profile) { nickname.value = profile.nickname; @@ -87,16 +87,20 @@ const loadProfile = async () => { location.value = profile.fields.Location; } following.value = currentMyFollowing.includes(agentPubKey.value); - mewsFeed.value = mews; } catch (error) { - console.error("erererere", error); showError(error); } finally { - loading.value = false; + loadingProfile.value = false; } }; -onMounted(loadProfile); +const load = () => { + loadProfile(); + loadMews(); +}; + +onMounted(load); + watch( () => route.params.agent, () => { diff --git a/ui/src/pages/MewsFeed.vue b/ui/src/pages/MewsFeed.vue index a210c8d2..6b497ce7 100644 --- a/ui/src/pages/MewsFeed.vue +++ b/ui/src/pages/MewsFeed.vue @@ -8,25 +8,19 @@
Your Mews Feed
- - - +
Meeoow, nothing here yet!
- - - - - + @@ -36,8 +30,7 @@ import { onMounted, ref } from "vue"; import { FeedMew, CreateMewInput } from "../types/types"; import { showError } from "../utils/notification"; import AddMew from "../components/AddMew.vue"; -import FeedItem from "../components/FeedItem.vue"; -import FeedItemSkeleton from "../components/FeedItemSkeleton.vue"; +import MewList from "../components/MewList.vue"; const loading = ref(false); const mews = ref([]); diff --git a/ui/src/pages/TagMewsFeed.vue b/ui/src/pages/TagMewsFeed.vue index d91a9535..a7557705 100644 --- a/ui/src/pages/TagMewsFeed.vue +++ b/ui/src/pages/TagMewsFeed.vue @@ -1,34 +1,22 @@