Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
josancamon19 committed Sep 3, 2024
2 parents 2515c6a + 49abe17 commit b02a24c
Show file tree
Hide file tree
Showing 12 changed files with 42 additions and 33 deletions.
5 changes: 1 addition & 4 deletions app/lib/pages/speaker_id/page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import 'package:flutter/material.dart';
import 'package:flutter_provider_utilities/flutter_provider_utilities.dart';
import 'package:friend_private/backend/preferences.dart';
import 'package:friend_private/backend/schema/bt_device.dart';
import 'package:friend_private/providers/websocket_provider.dart';
import 'package:friend_private/pages/home/page.dart';
import 'package:friend_private/pages/settings/people.dart';
import 'package:friend_private/pages/speaker_id/user_speech_samples.dart';
Expand All @@ -29,9 +28,6 @@ class SpeakerIdPage extends StatefulWidget {
class _SpeakerIdPageState extends State<SpeakerIdPage> with TickerProviderStateMixin {
@override
void initState() {
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
context.read<SpeechProfileProvider>().initialise(false);
});
super.initState();
}

Expand Down Expand Up @@ -264,6 +260,7 @@ class _SpeakerIdPageState extends State<SpeakerIdPage> with TickerProviderStateM
children: [
MaterialButton(
onPressed: () async {
context.read<SpeechProfileProvider>().initialise(false);
BleAudioCodec codec;
try {
codec = await getAudioCodec(provider.device!.id);
Expand Down
3 changes: 1 addition & 2 deletions app/lib/providers/speech_profile_provider.dart
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,8 @@ class SpeechProfileProvider extends ChangeNotifier with MessageNotifierMixin {
if (isFromOnboarding) {
await createMemory();
captureProvider?.clearTranscripts();
captureProvider?.resetState(restartBytesProcessing: true);
}

captureProvider?.resetState(restartBytesProcessing: true);
uploadingProfile = false;
profileCompleted = true;
updateLoadingText("You're all set!");
Expand Down
7 changes: 7 additions & 0 deletions frontend/public/sitemap.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>https://h.omi.me/</loc>
<priority>1</priority>
</url>
</urlset>
8 changes: 4 additions & 4 deletions frontend/sitemap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,18 @@ import getPublicMemoriesPrerender from './src/actions/memories/get-public-memori
export default async function sitemap(): Promise<MetadataRoute.Sitemap> {
if (envConfig.IS_DEVELOPMENT) return [];

const urls = [{ path: 'memories', priority: 0.9 }];
const urls = [{ path: 'memories', priority: 0.7 }];

const memories = await getPublicMemoriesPrerender(75000);
const memories = await getPublicMemoriesPrerender(20000);
const memoriesUrls = memories.map((memory) => ({
path: 'memories/' + memory.id,
priority: 0.7,
priority: 0.9,
}));
urls.push(...memoriesUrls);

return urls.map((item) => {
return {
url: `${envConfig.deploymentUrl}/${item.path}`,
url: `${envConfig.API_URL}/${item.path}`,
priority: item.priority,
};
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ export default async function getPublicMemoriesPrerender(maxCount = 40000) {
for (let i = 0; i < totalRequests; i += concurrentRequests) {
const promises = [];
for (let j = 0; j < concurrentRequests && i + j < totalRequests; j++) {
promises.push(getPublicMemories());
const offset = (i + j) * limit;
promises.push(getPublicMemories(offset, limit));
}
const results = await Promise.all(promises);
memories = memories.concat(results.flat());
Expand Down
17 changes: 11 additions & 6 deletions frontend/src/actions/memories/get-public-memories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,19 @@
import envConfig from '@/src/constants/envConfig';
import { Memory } from '@/src/types/memory.types';

export default async function getPublicMemories() {
export default async function getPublicMemories(
offset = 0,
limit = 500,
): Promise<Memory[]> {
try {
const response = await fetch(`${envConfig.API_URL}/v1/public-memories/`, {
headers: {
'Content-Type': 'application/json',
const response = await fetch(
`${envConfig.API_URL}/v1/public-memories?offset=${offset}&limit=${limit}`,
{
headers: {
'Content-Type': 'application/json',
},
},
next: { revalidate: 60 * 60 * 24 },
});
);
if (!response.ok) {
return [];
}
Expand Down
2 changes: 0 additions & 2 deletions frontend/src/actions/memories/get-shared-memory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
import envConfig from '@/src/constants/envConfig';
import { Memory } from '@/src/types/memory.types';

// example: 32190a0f-8229-4189-93a9-ba8156c952cb

export default async function getSharedMemory(id: string) {
try {
const response = await fetch(`${envConfig.API_URL}/v1/memories/${id}/shared`, {
Expand Down
10 changes: 5 additions & 5 deletions frontend/src/app/memories/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import getSharedMemory from '@/src/actions/memories/get-shared-memory';
import Memory from '@/src/components/memories/memory';
import envConfig from '@/src/constants/envConfig';
import { DEFAULT_TITLE_MEMORY } from '@/src/constants/memory';
import { Memory as MemoryType } from '@/src/types/memory.types';
import { ParamsTypes, SearchParamsTypes } from '@/src/types/params.types';
import { Metadata, ResolvingMetadata } from 'next';

Expand All @@ -15,13 +14,14 @@ export async function generateMetadata(
{ params }: { params: ParamsTypes },
parent: ResolvingMetadata,
): Promise<Metadata> {
const prevData = (await parent) as Metadata;
const memory = (await (
await fetch(`${envConfig.API_URL}/v1/memories/${params.id}/shared`, {
cache: 'no-cache',
next: {
revalidate: 60,
},
})
).json()) as MemoryType;

const prevData = (await parent) as Metadata;
).json()) as any;

const title = !memory
? 'Memory Not Found'
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/app/robots.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ export default function robots(): MetadataRoute.Robots {
return {
rules: {
userAgent: '*',
disallow: ['/memories/'],
allow: ['/'],
},
// sitemap: 'https://app.basehardhare.com/sitemap.xml',
sitemap: 'https://h.omi.me/sitemap.xml',
};
}
2 changes: 1 addition & 1 deletion frontend/src/components/memories/plugins/plugins.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default function Plugins({ plugins }: PluginsProps) {
</Suspense>
</ErrorBoundary>
<div className="bg-[#0f0f0f] px-4 md:px-12">
<Markdown className="prose prose-slate text-white md:prose-lg prose-p:m-0 prose-p:mt-3 prose-p:text-white last:prose-p:mt-8 last:prose-p:rounded-lg last:prose-p:bg-zinc-900 last:prose-p:p-2 last:prose-p:px-4 last:prose-p:text-zinc-300 prose-strong:text-white prose-ul:my-0 prose-ul:list-disc prose-li:text-zinc-400 md:last:prose-p:text-sm">
<Markdown className="prose prose-slate text-white md:prose-lg prose-p:m-0 prose-p:mt-3 prose-p:text-white last:prose-p:mt-8 last:prose-p:rounded-lg last:prose-p:bg-zinc-900 last:prose-p:p-2 last:prose-p:px-4 last:prose-p:text-zinc-200 prose-strong:text-white prose-ul:my-0 prose-ul:list-disc prose-li:text-zinc-300 md:last:prose-p:text-sm">
{puglin.content}
</Markdown>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,18 @@ export default function TranscriptionSegment({
return (
<li className="my-5 flex gap-2">
{isUser ? (
<div className='min-w-7 h-7 bg-zinc-800 rounded-full grid place-items-center'>
<div className="grid h-7 min-w-7 place-items-center rounded-full bg-zinc-800">
<UserStar className="text-xs" />
</div>
) : (
<div className='min-w-7 h-7 rounded-full grid place-items-center'>
<UserCircle className="min-w-min" color={color} />
</div>
<div className="grid h-7 min-w-7 place-items-center rounded-full">
<UserCircle className="min-w-min" color={color} />
</div>
)}
<div>
<p className="text-base font-semibold md:text-lg">{isUser ? `Owner` : `Speaker ${segment.speaker_id}`}</p>
<p className="text-base font-semibold md:text-lg">
{isUser ? `Owner` : `Speaker ${segment.speaker_id}`}
</p>
<p className="text-base font-extralight leading-7 md:text-lg md:leading-9">
{showMore
? textFormatted
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/constants/envConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const envConfig = {
API_URL: process.env.API_URL,
NODE_ENV: process.env.NEXT_PUBLIC_NODE_ENV,
IS_DEVELOPMENT: process.env.NEXT_PUBLIC_NODE_ENV === 'development',
WEB_URL: process.env.WEB_URL ?? 'https://omitdotme.web.app',
WEB_URL: process.env.WEB_URL ?? 'https://h.omi.me',
};

export default envConfig;

0 comments on commit b02a24c

Please sign in to comment.