Skip to content

Commit 553dca2

Browse files
authored
Merge pull request #11 from RNViththagan/Develop
Develop
2 parents 7ad892c + 21bee31 commit 553dca2

File tree

4 files changed

+44
-15
lines changed

4 files changed

+44
-15
lines changed

.github/workflows/auto-merge.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Auto Merge Develop to Main
33
on:
44
push:
55
branches:
6-
- Develop # Trigger action on push to Develop (with a capital D)
6+
- Develop # Trigger action on push to Develop
77

88
jobs:
99
merge:
@@ -12,7 +12,7 @@ jobs:
1212
- name: Checkout code
1313
uses: actions/checkout@v2
1414

15-
- name: Get last commit message on develop
15+
- name: Get last commit message on Develop
1616
id: last_commit
1717
run: |
1818
LAST_COMMIT_MSG=$(git log -1 --pretty=%B)
@@ -29,14 +29,17 @@ jobs:
2929
git fetch origin main
3030
git checkout main
3131
32-
- name: Merge develop into main (if commit message matches)
32+
- name: Merge Develop into main (if commit message matches)
3333
run: |
3434
# Convert commit message to lowercase for case-insensitive comparison
3535
COMMIT_MSG_LOWER=$(echo "${{ steps.last_commit.outputs.commit_message }}" | tr '[:upper:]' '[:lower:]')
3636
3737
if [[ "$COMMIT_MSG_LOWER" == *"ready to deploy"* ]]; then
3838
echo "Commit message matches, merging Develop into main."
3939
git merge origin/Develop --no-ff --allow-unrelated-histories -m "Merge Develop into main"
40+
# Attempt the merge and capture the result
41+
git merge origin/Develop --no-ff -m "Merge Develop into main" || { echo "Merge conflicts detected, skipping push."; exit 1; }
42+
4043
git push origin main
4144
else
4245
echo "Commit message does not match, skipping merge."

src/App.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,25 @@ import { BrowserRouter as Router, Routes, Route } from "react-router-dom";
22
import { Header } from "./components/Header";
33
import { Home } from "./pages/Home";
44
import { About } from "./pages/About";
5+
import { useState } from "react";
56

67
function App() {
8+
const [hasSearched, setHasSearched] = useState(false);
9+
// Function to reset the search state
10+
const resetSearch = () => {
11+
setHasSearched(false); // Reset the state when the logo is clicked
12+
};
713
return (
814
<Router basename="/software-advisor">
915
<div className="min-h-screen bg-gray-50">
10-
<Header />
16+
<Header onLogoClick={resetSearch} />
1117
<Routes>
12-
<Route path="/" element={<Home />} />
18+
<Route
19+
path="/"
20+
element={
21+
<Home hasSearched={hasSearched} setHasSearched={setHasSearched} />
22+
}
23+
/>
1324
<Route path="/about" element={<About />} />
1425
</Routes>
1526
</div>

src/components/Header.tsx

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
1-
import React from 'react';
2-
import { Link } from 'react-router-dom';
3-
import { AppWindow, Globe, Github, Info } from 'lucide-react';
4-
5-
export function Header() {
1+
import { Link } from "react-router-dom";
2+
import { AppWindow, Globe, Github, Info } from "lucide-react";
3+
interface HeaderProps {
4+
onLogoClick: () => void;
5+
}
6+
export function Header({ onLogoClick }: HeaderProps) {
67
return (
78
<header className="bg-white shadow-sm">
89
<div className="max-w-7xl mx-auto px-4 py-6">
910
<div className="flex items-center justify-between">
10-
<Link to="/" className="flex items-center">
11+
<Link to="/" className="flex items-center" onClick={onLogoClick}>
12+
{" "}
1113
<AppWindow className="h-8 w-8 text-blue-600" />
12-
<h1 className="ml-3 text-2xl font-bold text-gray-900">Software Advisor</h1>
14+
<h1 className="ml-3 text-2xl font-bold text-gray-900">
15+
Software Advisor
16+
</h1>
1317
</Link>
1418
<div className="flex items-center space-x-4">
1519
<Link
@@ -42,4 +46,4 @@ export function Header() {
4246
</div>
4347
</header>
4448
);
45-
}
49+
}

src/pages/Home.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,12 @@ import { SoftwareCard } from "../components/SoftwareCard";
55
import { getSuggestions, analyzeSoftwareNeeds } from "../lib/gemini";
66
import debounce from "lodash/debounce";
77

8-
export function Home() {
8+
interface HomeProps {
9+
hasSearched: boolean;
10+
setHasSearched: React.Dispatch<React.SetStateAction<boolean>>;
11+
}
12+
13+
export function Home({ hasSearched, setHasSearched }: HomeProps) {
914
const [filters, setFilters] = useState({
1015
category: "all",
1116
pricing: "all",
@@ -21,13 +26,19 @@ export function Home() {
2126
const [showDescriptionSuggestions, setShowDescriptionSuggestions] =
2227
useState(false);
2328
const [isLoading, setIsLoading] = useState(false);
24-
const [hasSearched, setHasSearched] = useState(false);
2529
const [aiAnalysis, setAiAnalysis] = useState<any>(null);
2630
const searchRef = useRef<HTMLDivElement>(null);
2731
const descriptionRef = useRef<HTMLDivElement>(null);
2832
const allPlatforms: any[] = ["Android", "iOS"];
2933
const [software, setSoftware] = useState([]);
3034

35+
// Reset taskDescription when hasSearched becomes false
36+
useEffect(() => {
37+
if (!hasSearched) {
38+
setTaskDescription(""); // Reset taskDescription to empty
39+
}
40+
}, [hasSearched]); // Depend on hasSearched, so it runs whenever it changes
41+
3142
const debouncedGetSuggestions = useRef(
3243
debounce(async (input: string) => {
3344
const suggestions = await getSuggestions(input);

0 commit comments

Comments
 (0)