-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'stage' of https://github.com/AletheiaFact/aletheia into…
… fix-load-search-overlay
- Loading branch information
Showing
37 changed files
with
532 additions
and
152 deletions.
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+7.47 KB
.yarn/cache/@emotion-weak-memoize-npm-0.4.0-76aafb2333-db5da0e89b.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+18.8 KB
.yarn/cache/@floating-ui-react-dom-npm-2.1.2-9e283fcbfa-25bb031686.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+2.03 KB
.yarn/cache/@mui-core-downloads-tracker-npm-6.1.8-cda6aa8f67-87e10a0990.zip
Binary file not shown.
Binary file added
BIN
+1.55 MB
.yarn/cache/@mui-joy-npm-5.0.0-dev.240424162023-9968b4889d-28d93d935a-79d55a5fe3.zip
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
{ | ||
"title": "AletheiaFact {{date}} Donation Campaign", | ||
"paragraph": "AletheiaFact.org works to combat misinformation and strengthen fact-checking. With your donation, you support the movement against FAKE NEWS, ensuring reliable information reaches you.", | ||
"donateButton": "Donate to aletheia", | ||
"showButton": "Show", | ||
"hideButton": "Hide" | ||
|
||
"title": "AletheiaFact.org needs you to survive", | ||
"paragraph": "AletheiaFact.org is unique and relies on the community. No ads, no subscriptions, we are driven by the passion to ensure free and reliable access to information. With your help, we continue to be a trusted reference. <strong>Our strength lies in the community – and that includes you.</strong> Today, we ask you to support us in this commitment to the truth. Show Brazil that reliable and impartial information is essential and that you stand with us in this mission. <strong>Donate now and help strengthen the fight against misinformation.</strong> Even a small donation makes a big difference. This is the time to act so that together, we can promote more democratic journalism and fight misinformation. <strong>Thank you for believing in AletheiaFact.org.</strong>", | ||
"yesDonateButton": "I want to contribute!", | ||
"noDonateButton": "I don't want to donate" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,6 @@ | ||
{ | ||
"title": "Campanha doação AletheiaFact {{date}}", | ||
"paragraph": "A AletheiaFact.org trabalha para combater a desinformação e fortalecer a checagem de fatos. Com sua doação, você apoia o movimento contra FAKE NEWS e informações confiáveis cheguem a você.", | ||
"donateButton": "Doe para aletheia", | ||
"showButton": "Mostrar", | ||
"hideButton": "Ocultar" | ||
|
||
"title": "A AletheiaFact.org precisa de você para sobreviver", | ||
"paragraph": "A AletheiaFact.org é única e depende da comunidade. Sem anúncios, sem assinaturas, somos movidos pela paixão de garantir acesso livre e confiável à informação. Com sua ajuda, continuamos sendo um referencial de confiança. <strong>Nossa força está na comunidade – e isso inclui você.</strong> Hoje, pedimos que nos apoie nesse compromisso com a verdade. Mostre ao Brasil que informações confiáveis e imparciais são essenciais e que você está ao nosso lado nessa missão. <strong>Doe agora e ajude a fortalecer o combate à desinformação.</strong> Mesmo uma doação pequena faz uma grande diferença. Este é o momento de agir para que, juntos, possamos promover um jornalismo mais democrático e combater a desinformação. <strong>Obrigado por acreditar na AletheiaFact.org.</strong>", | ||
"yesDonateButton": "Quero contribuir!", | ||
"noDonateButton": "Não quero doar" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import { NestFactory } from "@nestjs/core"; | ||
import { AppModule } from "../app.module"; | ||
import { NestExpressApplication } from "@nestjs/platform-express"; | ||
import { UsersService } from "../users/users.service"; | ||
import { NotificationService } from "../notifications/notifications.service"; | ||
import { WinstonLogger } from "../winstonLogger"; | ||
import loadConfig from "../configLoader"; | ||
|
||
async function createNovuSubscriber(userFromDB, novuService) { | ||
if (!userFromDB || !userFromDB.id) { | ||
throw new Error(`Invalid user data: ${JSON.stringify(userFromDB)}`); | ||
} | ||
|
||
try { | ||
await novuService.createSubscriber({ | ||
_id: userFromDB.id, | ||
email: userFromDB.email, | ||
name: userFromDB.name, | ||
}); | ||
console.log(`Subscriber created for user ${userFromDB.email}`); | ||
} catch (error) { | ||
throw new Error( | ||
`Failed to create Novu subscriber for user ${userFromDB.email}: ${error.message}` | ||
); | ||
} | ||
} | ||
|
||
async function initApp() { | ||
const options = loadConfig(); | ||
const logger = new WinstonLogger(); | ||
|
||
const app = await NestFactory.create<NestExpressApplication>( | ||
AppModule.register(options) | ||
); | ||
|
||
logger.log(`AppModule loaded`); | ||
|
||
const userService = await app.resolve(UsersService); | ||
const novuService = await app.resolve(NotificationService); | ||
|
||
try { | ||
const users = await userService.getAllUsers(); | ||
|
||
for (const user of users) { | ||
await createNovuSubscriber(user, novuService); | ||
logger.log(`Novu subscriber created for user: ${user.email}`); | ||
} | ||
|
||
logger.log("All users have been processed for Novu subscription."); | ||
} catch (error) { | ||
logger.error( | ||
"An error occurred while creating Novu subscribers:", | ||
error | ||
); | ||
} finally { | ||
await app.close(); | ||
} | ||
} | ||
|
||
initApp(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,51 @@ | ||
import React, { useState } from "react"; | ||
import React, { useEffect, useState } from "react"; | ||
import DonationBannerContent from "./DonationBanner/DonationBannerContent"; | ||
import DonationBannerStyle from "./DonationBanner.style"; | ||
import { Col } from "antd"; | ||
import { useTranslation } from "next-i18next"; | ||
import Cookies from "js-cookie"; | ||
import CloseOutlined from "@mui/icons-material/CloseOutlined"; | ||
|
||
const closeBanner = (onClose) => { | ||
onClose(); | ||
Cookies.set("cta_donation_banner_show", "false"); | ||
}; | ||
|
||
const DonationBanner = () => { | ||
const { t } = useTranslation(); | ||
const [isBannerVisible, setIsBannerVisible] = useState(true); | ||
const enableDonationBanner = process.env.NEXT_PUBLIC_ENABLE_BANNER_DONATION === "true"; | ||
const handleToggleBanner = () => { | ||
setIsBannerVisible((prev) => !prev); | ||
} | ||
const enableDonationBanner = | ||
process.env.NEXT_PUBLIC_ENABLE_BANNER_DONATION === "true"; | ||
const [showDonationBanner, setDonationBanner] = useState<boolean>(false); | ||
|
||
useEffect(() => { | ||
const CloseBannerCookies = Cookies.get("cta_donation_banner_show"); | ||
if (CloseBannerCookies) { | ||
return setDonationBanner(false); | ||
} | ||
setDonationBanner(true); | ||
}, []); | ||
|
||
if (!enableDonationBanner){ | ||
return null | ||
}; | ||
if (!enableDonationBanner) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<DonationBannerStyle> | ||
<Col className="banner-container"> | ||
{isBannerVisible && <DonationBannerContent />} | ||
<button | ||
className="show-banner" | ||
onClick={handleToggleBanner}> | ||
{isBannerVisible ? t("donationBanner:hideButton") : t("donationBanner:showButton")} | ||
</button> | ||
</Col> | ||
</DonationBannerStyle > | ||
); | ||
return ( | ||
showDonationBanner && ( | ||
<DonationBannerStyle> | ||
<Col className="banner-container"> | ||
<CloseOutlined | ||
className="close-banner" | ||
onClick={() => | ||
closeBanner(() => setDonationBanner(false)) | ||
} | ||
/> | ||
<DonationBannerContent | ||
closeClick={() => | ||
closeBanner(() => setDonationBanner(false)) | ||
} | ||
/> | ||
</Col> | ||
</DonationBannerStyle> | ||
) | ||
); | ||
}; | ||
|
||
export default DonationBanner; |
25 changes: 19 additions & 6 deletions
25
src/components/Home/DonationBanner/DonationBannerButton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.