Skip to content

Commit

Permalink
Completed Announcement
Browse files Browse the repository at this point in the history
  • Loading branch information
PriyansuMaurya committed Aug 15, 2023
1 parent e8825eb commit 93c5a38
Showing 1 changed file with 12 additions and 13 deletions.
25 changes: 12 additions & 13 deletions components/Announcement.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"use client";
import { useState } from "react";
import { RxCross2 } from "react-icons/rx";
import React, { useState } from "react";


async function getCurrentVersion() {
Expand All @@ -9,27 +9,26 @@ async function getCurrentVersion() {
);
const data = await response.json();
return data.tag_name;
// https://github.com/PriyansuMaurya/AI-Fusion/releases/tag/v1.2.4-beta
// return v1.2.4-beta
}


export default function Announcement() {
const [announcement, setAnnouncement] = useState(true);
const announcements = [
<div>Check what has changed in the <strong className="underline underline-offset-1"><a href="https://github.com/PriyansuMaurya/AI-Fusion/releases/latest" rel="external noopener noreferrer" target="_blank">{getCurrentVersion()}</a></strong></div>,
<div>⭐️ If you like AI Fusion, give it a star on <a className="underline underline-offset-1" href="https://github.com/PriyansuMaurya/AI-Fusion/" rel="external noopener noreferrer" target="_blank">GitHub</a></div>
]

const getAnnouncement = () => {
let randomIndex = Math.floor(Math.random() * announcements.length);
return announcements[randomIndex]
}

return (
announcement &&
<div className="flex items-center justify-between bg-[--primary-color] text-[--light-bg] ease-out duration-300 undefined">
<div className="mx-3 md:mx-5" ></div>
<div className=" px-4 py-2 text-center text-sm "> {getAnnouncement()}
<div className="mx-3 md:mx-5" />
<div className=" px-4 py-2 text-center text-sm "> {
[
<>Check what has changed in the <strong className="underline underline-offset-1"><a href="https://github.com/PriyansuMaurya/AI-Fusion/releases/latest" rel="external noopener noreferrer" target="_blank">{getCurrentVersion()}</a></strong></>,
<>⭐️ If you like AI Fusion, give it a star on <a className="underline underline-offset-1" href="https://github.com/PriyansuMaurya/AI-Fusion/" rel="external noopener noreferrer" target="_blank">GitHub</a></>
][Math.floor(Math.random() * 2)]
}
</div>
{/* <div className="mx-3 md:mx-5" /> */}

<button onClick={() => setAnnouncement(false)}><RxCross2 className="mx-3 md:mx-5 hover:text-[--dark-bg] ease-out duration-300" size={20} /></button>

</div>
Expand Down

0 comments on commit 93c5a38

Please sign in to comment.