diff --git a/.env.example b/.env.example index 1625c64..35db1dd 100644 --- a/.env.example +++ b/.env.example @@ -20,12 +20,12 @@ LOG_STACK=single LOG_DEPRECATIONS_CHANNEL=null LOG_LEVEL=debug -DB_CONNECTION=mysql -DB_HOST=db -DB_PORT=3306 -DB_DATABASE=incr -DB_USERNAME=incr_user -DB_PASSWORD=incr_password +DB_CONNECTION=sqlite +# DB_HOST=127.0.0.1 +# DB_PORT=3306 +# DB_DATABASE=laravel +# DB_USERNAME=root +# DB_PASSWORD= SESSION_DRIVER=database SESSION_LIFETIME=120 diff --git a/Jenkinsfile b/Jenkinsfile deleted file mode 100644 index 4074927..0000000 --- a/Jenkinsfile +++ /dev/null @@ -1,63 +0,0 @@ -pipeline { - agent any - - triggers { - GenericTrigger( - causeString: 'Triggered on tag push', - token: 'tag-trigger-secret', - printContributedVariables: true, - printPostContent: true, - regexpFilterExpression: 'ref=refs/tags/.*\nafter=(?!0{40}).*', - regexpFilterText: '$ref\n$after', - genericVariables: [ - [key: 'ref', value: '$.ref'], - [key: 'after', value: '$.after'] - ] - ) - } - - environment { - REGISTRY = 'codeberg.org' - IMAGE_NAME = "${REGISTRY}/lvl0/incr" - DOCKER_CREDENTIALS_ID = 'codeberg-registry' - } - - stages { - stage('Tag Push Filter') { - steps { - script { - if (!env.ref?.startsWith('refs/tags/')) { - echo "Not a tag push (ref = ${env.ref}). Skipping build." - currentBuild.result = 'NOT_BUILT' - return - } - } - } - } - - stage('Build & Push Docker Image') { - when { - expression { - return env.ref?.startsWith('refs/tags/') && env.after != null && env.after != "0000000000000000000000000000000000000000" - } - } - steps { - script { - def tagName = env.ref.replaceFirst(/^refs\/tags\//, '') - def cleanedTag = tagName.replaceFirst(/^v/, '') - - sh "docker build -t $IMAGE_NAME:$cleanedTag -f docker/Dockerfile ." - - withCredentials([usernamePassword(credentialsId: "$DOCKER_CREDENTIALS_ID", usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) { - sh """ - echo "$PASSWORD" | docker login $REGISTRY -u "$USERNAME" --password-stdin - docker push $IMAGE_NAME:$cleanedTag - docker tag $IMAGE_NAME:$cleanedTag $IMAGE_NAME:latest - docker push $IMAGE_NAME:latest - """ - } - } - } - } - } -} diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 27d7354..0000000 --- a/LICENSE +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. diff --git a/README.md b/README.md deleted file mode 100644 index a7eb0fa..0000000 --- a/README.md +++ /dev/null @@ -1,157 +0,0 @@ -
- -# 📈 incr - -**A minimalist investment tracker for VWCE shares with milestone-driven progress** - -*Track your portfolio growth with visual progress indicators and milestone reinforcement* - -[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0) -[![Docker](https://img.shields.io/badge/Docker-Ready-2496ED?logo=docker&logoColor=white)](https://www.docker.com/) -[![Laravel](https://img.shields.io/badge/Laravel-12-FF2D20?logo=laravel&logoColor=white)](https://laravel.com/) -[![React](https://img.shields.io/badge/React-19-61DAFB?logo=react&logoColor=black)](https://reactjs.org/) - ---- - -**[Introduction](#introduction) • [Features](#features) • [Tech Stack](#tech-stack) • [Getting Started](#getting-started) • [Development](#development) • [Contributing](#contributing) • [License](#license)** - ---- - -
- -## Introduction - -Incr is a minimalist, one-page investment tracking application designed specifically for VWCE (Vanguard FTSE All-World UCITS ETF) shareholders. It combines the satisfaction of visual progress tracking with practical portfolio management, featuring a distinctive LED-style digital display and milestone-based goal setting. - -The application emphasizes simplicity and focus, providing just what you need to track your investment journey without overwhelming complexity. - -## Features - -- **LED-style display**: Large red digital counter showing current share count -- **Progress tracking**: Visual progress bar toward configurable milestones -- **Purchase management**: Add and track share purchases with historical data -- **Financial insights**: Portfolio value and withdrawal estimates -- **Milestone cycling**: Track progress toward multiple investment goals (1500→3000→4500→6000) - -## Tech Stack - -- **Backend**: Laravel 12 (PHP 8.2+) with MySQL database -- **Frontend**: React 19 + TypeScript with Inertia.js -- **Styling**: Tailwind CSS 4 with shadcn/ui components -- **Deployment**: Docker with multi-stage builds - -## Getting Started - -### Quick Start (Production) - -#### Docker - -Clone the repository and run with Docker Compose: - -```bash -git clone https://github.com/your-username/incr.git -cd incr -``` - -Run the application using the provided docker-compose configuration: - -```bash -# Using Docker Compose -docker-compose -f docker/production/docker-compose.yml up --build - -# Or using Podman Compose -podman-compose -f docker/production/docker-compose.yml up --build -``` - -The application will be available at `http://localhost:5001`. - -### Development - -#### Local Development Setup - -**Option 1: Laravel Sail (Docker)** - -For local development with Laravel Sail: - -```bash -# Install Laravel Sail -composer install -sail artisan sail:install - -# Start development environment -sail up -d - -# Install frontend dependencies and build assets -npm install -npm run dev - -# Run migrations -sail artisan migrate -``` - -**Option 2: Podman Development** - -For Fedora Atomic or other Podman-based systems: - -```bash -# Quick start with helper script -bash docker/dev/podman/start-dev.sh - -# Or manually: -# Install podman-compose if not available -pip3 install --user podman-compose - -# Start development environment -podman-compose -f docker/dev/podman/docker-compose.yml up -d - -# Run migrations -podman exec incr-dev-app php artisan migrate -``` - -**Option 3: Sail with Podman (Compatibility Layer)** - -To use Laravel Sail commands with Podman: - -```bash -# Source the alias script -source docker/dev/podman/podman-sail-alias.sh - -# Now you can use sail commands as normal -sail up -d -sail artisan migrate -sail npm run dev -``` - -The development server will be available at `http://localhost` with hot reload enabled. - -## Project Structure - -- `app/` - Laravel backend (controllers, models, services) -- `resources/js/` - React frontend components and pages -- `docker/production/` - Production Docker configuration -- `docker/dev/podman/` - Development Podman configuration -- `database/migrations/` - Database schema definitions - -## Contributing - -We welcome contributions to incr! Whether you're reporting bugs, suggesting features, or submitting pull requests, your input helps make this project better. - -### How to Contribute - -1. Fork the repository -2. Create a feature branch (`git checkout -b feature/amazing-feature`) -3. Commit your changes (`git commit -m 'Add some amazing feature'`) -4. Push to the branch (`git push origin feature/amazing-feature`) -5. Open a Pull Request - -### Bug Reports - -If you find a bug, please create an issue with: -- A clear description of the problem -- Steps to reproduce the issue -- Expected vs actual behavior -- Your environment details - -## License - -This project is licensed under the GNU General Public License v3.0 - see the [LICENSE](LICENSE) file for details. diff --git a/app/Http/Controllers/AssetController.php b/app/Http/Controllers/AssetController.php deleted file mode 100644 index 16adc1b..0000000 --- a/app/Http/Controllers/AssetController.php +++ /dev/null @@ -1,106 +0,0 @@ -get(); - - return response()->json($assets); - } - - public function current(): JsonResponse - { - // Get the first/default user (since no auth) - $user = \App\Models\User::first(); - $asset = $user ? $user->asset : null; - - return response()->json([ - 'asset' => $asset, - ]); - } - - public function setCurrent(Request $request) - { - $validated = $request->validate([ - 'symbol' => 'required|string|max:10', - 'full_name' => 'nullable|string|max:255', - ]); - - $asset = Asset::findOrCreateBySymbol( - $validated['symbol'], - $validated['full_name'] ?? null - ); - - // Get or create the first/default user (since no auth) - $user = \App\Models\User::first(); - - if (!$user) { - // Create a default user if none exists - $user = \App\Models\User::create([ - 'name' => 'Default User', - 'email' => 'user@example.com', - 'password' => 'password', // This will be hashed automatically - 'asset_id' => $asset->id, - ]); - } else { - $user->update(['asset_id' => $asset->id]); - } - - return back()->with('success', 'Asset set successfully!'); - } - - public function store(Request $request): JsonResponse - { - $validated = $request->validate([ - 'symbol' => 'required|string|max:10|unique:assets,symbol', - 'full_name' => 'nullable|string|max:255', - ]); - - $asset = Asset::create([ - 'symbol' => strtoupper($validated['symbol']), - 'full_name' => $validated['full_name'], - ]); - - return response()->json([ - 'success' => true, - 'message' => 'Asset created successfully!', - 'asset' => $asset, - ], 201); - } - - public function show(Asset $asset): JsonResponse - { - $asset->load('assetPrices'); - $currentPrice = $asset->currentPrice(); - - return response()->json([ - 'asset' => $asset, - 'current_price' => $currentPrice, - ]); - } - - public function search(Request $request): JsonResponse - { - $query = $request->get('q'); - - if (!$query) { - return response()->json([]); - } - - $assets = Asset::where('symbol', 'like', "%{$query}%") - ->orWhere('full_name', 'like', "%{$query}%") - ->orderBy('symbol') - ->limit(10) - ->get(); - - return response()->json($assets); - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Pricing/PricingController.php b/app/Http/Controllers/Pricing/PricingController.php index 2a484be..bb07156 100644 --- a/app/Http/Controllers/Pricing/PricingController.php +++ b/app/Http/Controllers/Pricing/PricingController.php @@ -11,11 +11,7 @@ class PricingController extends Controller { public function current(): JsonResponse { - // Get the first/default user (since no auth) - $user = \App\Models\User::first(); - $assetId = $user ? $user->asset_id : null; - - $price = AssetPrice::current($assetId); + $price = AssetPrice::current(); return response()->json([ 'current_price' => $price, @@ -29,37 +25,22 @@ public function update(Request $request) 'price' => 'required|numeric|min:0.0001', ]); - // Get the first/default user (since no auth) - $user = \App\Models\User::first(); - - if (!$user || !$user->asset_id) { - return back()->withErrors(['asset' => 'Please set an asset first.']); - } - - $assetPrice = AssetPrice::updatePrice($user->asset_id, $validated['date'], $validated['price']); + $assetPrice = AssetPrice::updatePrice($validated['date'], $validated['price']); return back()->with('success', 'Asset price updated successfully!'); } public function history(Request $request): JsonResponse { - // Get the first/default user (since no auth) - $user = \App\Models\User::first(); - $assetId = $user ? $user->asset_id : null; - $limit = $request->get('limit', 30); - $history = AssetPrice::history($assetId, $limit); + $history = AssetPrice::history($limit); return response()->json($history); } public function forDate(Request $request, string $date): JsonResponse { - // Get the first/default user (since no auth) - $user = \App\Models\User::first(); - $assetId = $user ? $user->asset_id : null; - - $price = AssetPrice::forDate($date, $assetId); + $price = AssetPrice::forDate($date); return response()->json([ 'date' => $date, diff --git a/app/Http/Controllers/Transactions/PurchaseController.php b/app/Http/Controllers/Transactions/PurchaseController.php index 648e304..b0bd1a1 100644 --- a/app/Http/Controllers/Transactions/PurchaseController.php +++ b/app/Http/Controllers/Transactions/PurchaseController.php @@ -17,7 +17,7 @@ public function index(): JsonResponse return response()->json($purchases); } - public function store(Request $request) + public function store(Request $request): JsonResponse { $validated = $request->validate([ 'date' => 'required|date|before_or_equal:today', @@ -41,7 +41,10 @@ public function store(Request $request) 'total_cost' => $validated['total_cost'], ]); - return back()->with('success', 'Purchase added successfully!'); + return response()->json([ + 'success' => true, + 'message' => 'Purchase added successfully!', + ]); } public function summary() diff --git a/app/Models/Asset.php b/app/Models/Asset.php deleted file mode 100644 index 88fe97a..0000000 --- a/app/Models/Asset.php +++ /dev/null @@ -1,67 +0,0 @@ - 'string', - 'full_name' => 'string', - ]; - - public function assetPrices(): HasMany - { - return $this->hasMany(Pricing\AssetPrice::class); - } - - public function users(): HasMany - { - return $this->hasMany(User::class); - } - - public function currentPrice(): ?float - { - $latestPrice = $this->assetPrices()->latest('date')->first(); - - return $latestPrice ? $latestPrice->price : null; - } - - public static function findBySymbol(string $symbol): ?self - { - return static::where('symbol', strtoupper($symbol))->first(); - } - - public static function findOrCreateBySymbol(string $symbol, ?string $fullName = null): self - { - $asset = static::findBySymbol($symbol); - - if (! $asset) { - $asset = static::create([ - 'symbol' => strtoupper($symbol), - 'full_name' => $fullName, - ]); - } - - return $asset; - } -} diff --git a/app/Models/Pricing/AssetPrice.php b/app/Models/Pricing/AssetPrice.php index e3f5d04..2d3b6cf 100644 --- a/app/Models/Pricing/AssetPrice.php +++ b/app/Models/Pricing/AssetPrice.php @@ -5,7 +5,6 @@ use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; -use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Support\Carbon; /** @@ -21,7 +20,6 @@ class AssetPrice extends Model use HasFactory; protected $fillable = [ - 'asset_id', 'date', 'price', ]; @@ -31,54 +29,32 @@ class AssetPrice extends Model 'price' => 'decimal:4', ]; - public function asset(): BelongsTo + public static function current(): ?float { - return $this->belongsTo(\App\Models\Asset::class); - } - - public static function current(int $assetId = null): ?float - { - $query = static::latest('date'); - - if ($assetId) { - $query->where('asset_id', $assetId); - } - - $latestPrice = $query->first(); + $latestPrice = static::latest('date')->first(); return $latestPrice ? $latestPrice->price : null; } - public static function forDate(string $date, int $assetId = null): ?float + public static function forDate(string $date): ?float { - $query = static::where('date', '<=', $date) - ->orderBy('date', 'desc'); - - if ($assetId) { - $query->where('asset_id', $assetId); - } - - $price = $query->first(); + $price = static::where('date', '<=', $date) + ->orderBy('date', 'desc') + ->first(); return $price ? $price->price : null; } - public static function updatePrice(int $assetId, string $date, float $price): self + public static function updatePrice(string $date, float $price): self { return static::updateOrCreate( - ['asset_id' => $assetId, 'date' => $date], + ['date' => $date], ['price' => $price] ); } - public static function history(int $assetId = null, int $limit = 30): Collection + public static function history(int $limit = 30): Collection { - $query = static::orderBy('date', 'desc')->limit($limit); - - if ($assetId) { - $query->where('asset_id', $assetId); - } - - return $query->get(); + return static::orderBy('date', 'desc')->limit($limit)->get(); } } diff --git a/app/Models/User.php b/app/Models/User.php index e8d3f00..749c7b7 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -4,13 +4,9 @@ // use Illuminate\Contracts\Auth\MustVerifyEmail; use Illuminate\Database\Eloquent\Factories\HasFactory; -use Illuminate\Database\Eloquent\Relations\BelongsTo; use Illuminate\Foundation\Auth\User as Authenticatable; use Illuminate\Notifications\Notifiable; -/** - * @property int $asset_id - */ class User extends Authenticatable { /** @use HasFactory<\Database\Factories\UserFactory> */ @@ -25,7 +21,6 @@ class User extends Authenticatable 'name', 'email', 'password', - 'asset_id', ]; /** @@ -38,6 +33,11 @@ class User extends Authenticatable 'remember_token', ]; + /** + * Get the attributes that should be cast. + * + * @return array + */ protected function casts(): array { return [ @@ -45,27 +45,4 @@ protected function casts(): array 'password' => 'hashed', ]; } - - public function asset(): BelongsTo - { - return $this->belongsTo(Asset::class); - } - - public function hasCompletedOnboarding(): bool - { - // Check if user has asset, purchases, and milestones - return $this->asset_id !== null - && $this->hasPurchases() - && $this->hasMilestones(); - } - - public function hasPurchases(): bool - { - return \App\Models\Transactions\Purchase::totalShares() > 0; - } - - public function hasMilestones(): bool - { - return \App\Models\Milestone::count() > 0; - } } diff --git a/database/migrations/0001_01_01_000000_create_assets_table.php b/database/migrations/0001_01_01_000000_create_assets_table.php deleted file mode 100644 index a27ba44..0000000 --- a/database/migrations/0001_01_01_000000_create_assets_table.php +++ /dev/null @@ -1,25 +0,0 @@ -id(); - $table->string('symbol')->unique(); - $table->string('full_name')->nullable(); - $table->timestamps(); - - $table->index('symbol'); - }); - } - - public function down(): void - { - Schema::dropIfExists('assets'); - } -}; diff --git a/database/migrations/0001_01_01_000001_create_users_table.php b/database/migrations/0001_01_01_000000_create_users_table.php similarity index 91% rename from database/migrations/0001_01_01_000001_create_users_table.php rename to database/migrations/0001_01_01_000000_create_users_table.php index 9cb9538..05fb5d9 100644 --- a/database/migrations/0001_01_01_000001_create_users_table.php +++ b/database/migrations/0001_01_01_000000_create_users_table.php @@ -17,11 +17,8 @@ public function up(): void $table->string('email')->unique(); $table->timestamp('email_verified_at')->nullable(); $table->string('password'); - $table->foreignId('asset_id')->nullable()->constrained()->onDelete('set null'); $table->rememberToken(); $table->timestamps(); - - $table->index('asset_id'); }); Schema::create('password_reset_tokens', function (Blueprint $table) { diff --git a/database/migrations/0001_01_01_000002_create_cache_table.php b/database/migrations/0001_01_01_000001_create_cache_table.php similarity index 100% rename from database/migrations/0001_01_01_000002_create_cache_table.php rename to database/migrations/0001_01_01_000001_create_cache_table.php diff --git a/database/migrations/0001_01_01_000003_create_jobs_table.php b/database/migrations/0001_01_01_000002_create_jobs_table.php similarity index 100% rename from database/migrations/0001_01_01_000003_create_jobs_table.php rename to database/migrations/0001_01_01_000002_create_jobs_table.php diff --git a/database/migrations/2025_07_10_152716_create_asset_prices_table.php b/database/migrations/2025_07_10_152716_create_asset_prices_table.php index 36653db..94ebab3 100644 --- a/database/migrations/2025_07_10_152716_create_asset_prices_table.php +++ b/database/migrations/2025_07_10_152716_create_asset_prices_table.php @@ -10,13 +10,11 @@ public function up(): void { Schema::create('asset_prices', function (Blueprint $table) { $table->id(); - $table->foreignId('asset_id')->constrained()->onDelete('cascade'); $table->date('date'); $table->decimal('price', 10, 4); $table->timestamps(); - $table->unique(['asset_id', 'date']); - $table->index('asset_id'); + $table->unique('date'); $table->index('date'); }); } diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..6114e5a --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,55 @@ +services: + laravel.test: + build: + context: './vendor/laravel/sail/runtimes/8.4' + dockerfile: Dockerfile + args: + WWWGROUP: '${WWWGROUP}' + image: 'sail-8.4/app' + extra_hosts: + - 'host.docker.internal:host-gateway' + ports: + - '${APP_PORT:-80}:80' + - '${VITE_PORT:-5173}:${VITE_PORT:-5173}' + environment: + WWWUSER: '${WWWUSER}' + LARAVEL_SAIL: 1 + XDEBUG_MODE: '${SAIL_XDEBUG_MODE:-off}' + XDEBUG_CONFIG: '${SAIL_XDEBUG_CONFIG:-client_host=host.docker.internal}' + IGNITION_LOCAL_SITES_PATH: '${PWD}' + volumes: + - '.:/var/www/html' + networks: + - sail + depends_on: + - mysql + mysql: + image: 'mysql/mysql-server:8.0' + ports: + - '${FORWARD_DB_PORT:-3306}:3306' + environment: + MYSQL_ROOT_PASSWORD: '${DB_PASSWORD}' + MYSQL_ROOT_HOST: '%' + MYSQL_DATABASE: '${DB_DATABASE}' + MYSQL_USER: '${DB_USERNAME}' + MYSQL_PASSWORD: '${DB_PASSWORD}' + MYSQL_ALLOW_EMPTY_PASSWORD: 1 + volumes: + - 'sail-mysql:/var/lib/mysql' + - './vendor/laravel/sail/database/mysql/create-testing-database.sh:/docker-entrypoint-initdb.d/10-create-testing-database.sh' + networks: + - sail + healthcheck: + test: + - CMD + - mysqladmin + - ping + - '-p${DB_PASSWORD}' + retries: 3 + timeout: 5s +networks: + sail: + driver: bridge +volumes: + sail-mysql: + driver: local diff --git a/docker/dev/podman/Dockerfile b/docker/dev/podman/Dockerfile deleted file mode 100644 index 49d2834..0000000 --- a/docker/dev/podman/Dockerfile +++ /dev/null @@ -1,49 +0,0 @@ -FROM docker.io/library/php:8.2-fpm - -# Install system dependencies -RUN apt-get update && apt-get install -y \ - git \ - curl \ - libpng-dev \ - libonig-dev \ - libxml2-dev \ - zip \ - unzip \ - nodejs \ - npm \ - default-mysql-client \ - && docker-php-ext-install pdo_mysql mbstring exif pcntl bcmath gd - -# Install Composer -COPY --from=composer:latest /usr/bin/composer /usr/bin/composer - -# Set working directory -WORKDIR /var/www/html - -# Install Node.js 20.x (for better compatibility) -RUN curl -fsSL https://deb.nodesource.com/setup_20.x | bash - \ - && apt-get install -y nodejs - -# Copy composer files and install PHP dependencies -COPY composer.json composer.lock ./ -RUN composer install --no-dev --optimize-autoloader --no-scripts - -# Copy package.json and install Node dependencies -COPY package*.json ./ -RUN npm ci - -# Copy application code -COPY . . - -# Set permissions -RUN chown -R www-data:www-data /var/www/html \ - && chmod -R 755 /var/www/html/storage \ - && chmod -R 755 /var/www/html/bootstrap/cache - -# Copy and set up container start script -COPY docker/dev/podman/container-start.sh /usr/local/bin/container-start.sh -RUN chmod +x /usr/local/bin/container-start.sh - -EXPOSE 8000 5173 - -CMD ["/usr/local/bin/container-start.sh"] \ No newline at end of file diff --git a/docker/dev/podman/container-start.sh b/docker/dev/podman/container-start.sh deleted file mode 100644 index 4cfc0f6..0000000 --- a/docker/dev/podman/container-start.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash - -# Create .env file if it doesn't exist -if [ ! -f /var/www/html/.env ]; then - cp /var/www/html/.env.example /var/www/html/.env 2>/dev/null || touch /var/www/html/.env -fi - -# Fix database name to match compose file -sed -i 's/DB_DATABASE=incr$/DB_DATABASE=incr_dev/' /var/www/html/.env - -# Generate app key if not set or empty -if ! grep -q "APP_KEY=base64:" /var/www/html/.env; then - # Generate a new key and set it directly - NEW_KEY=$(php -r "echo 'base64:' . base64_encode(random_bytes(32));") - sed -i "s/APP_KEY=/APP_KEY=$NEW_KEY/" /var/www/html/.env -fi - -# Run migrations -php artisan migrate --force - -# Start Laravel development server in background -php artisan serve --host=0.0.0.0 --port=8000 & - -# Start Vite development server -npm run dev -- --host 0.0.0.0 - -# Wait for background processes -wait \ No newline at end of file diff --git a/docker/dev/podman/docker-compose.yml b/docker/dev/podman/docker-compose.yml deleted file mode 100644 index e874056..0000000 --- a/docker/dev/podman/docker-compose.yml +++ /dev/null @@ -1,72 +0,0 @@ -version: '3.8' - -services: - app: - build: - context: ../../.. - dockerfile: docker/dev/podman/Dockerfile - container_name: incr-dev-app - restart: unless-stopped - working_dir: /var/www/html - environment: - - APP_ENV=local - - APP_DEBUG=true - - APP_KEY=base64:YOUR_APP_KEY_HERE - - DB_CONNECTION=mysql - - DB_HOST=db - - DB_PORT=3306 - - DB_DATABASE=incr_dev - - DB_USERNAME=incr_user - - DB_PASSWORD=incr_password - - VITE_PORT=5173 - volumes: - - ../../../:/var/www/html:Z - - /var/www/html/node_modules - - /var/www/html/vendor - ports: - - "8000:8000" - - "5173:5173" - depends_on: - db: - condition: service_healthy - networks: - - incr-dev-network - - db: - image: docker.io/library/mysql:8.0 - container_name: incr-dev-db - restart: unless-stopped - environment: - - MYSQL_DATABASE=incr_dev - - MYSQL_USER=incr_user - - MYSQL_PASSWORD=incr_password - - MYSQL_ROOT_PASSWORD=root_password - volumes: - - db_data:/var/lib/mysql - ports: - - "3307:3306" - healthcheck: - test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "incr_user", "-pincr_password"] - timeout: 10s - retries: 10 - interval: 10s - start_period: 10s - networks: - - incr-dev-network - - redis: - image: docker.io/library/redis:7-alpine - container_name: incr-dev-redis - restart: unless-stopped - ports: - - "6379:6379" - networks: - - incr-dev-network - -networks: - incr-dev-network: - driver: bridge - -volumes: - db_data: - driver: local \ No newline at end of file diff --git a/docker/dev/podman/podman-sail-alias.sh b/docker/dev/podman/podman-sail-alias.sh deleted file mode 100644 index abd4463..0000000 --- a/docker/dev/podman/podman-sail-alias.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -# Podman aliases for Laravel Sail compatibility -# Source this file to use Sail commands with Podman -# Usage: source docker/dev/podman/podman-sail-alias.sh - -# Create docker alias pointing to podman -alias docker='podman' - -# Create docker-compose alias pointing to podman-compose -alias docker-compose='podman-compose' - -# Sail wrapper function that uses podman-compose -sail() { - if [[ -f docker/dev/podman/docker-compose.yml ]]; then - podman-compose -f docker/dev/podman/docker-compose.yml "$@" - else - echo "❌ Podman compose file not found at docker/dev/podman/docker-compose.yml" - return 1 - fi -} - -echo "✅ Podman aliases set up for Laravel Sail compatibility" -echo "🐳 'docker' → 'podman'" -echo "🔧 'docker-compose' → 'podman-compose'" -echo "⛵ 'sail' → uses podman-compose with dev configuration" \ No newline at end of file diff --git a/docker/dev/podman/start-dev.sh b/docker/dev/podman/start-dev.sh deleted file mode 100644 index a997713..0000000 --- a/docker/dev/podman/start-dev.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/bash - -# Podman development environment startup script for incr - -set -e - -echo "🚀 Starting incr development environment with Podman..." - -# Check if .env exists -if [ ! -f .env ]; then - echo "📋 Creating .env file from .env.example..." - cp .env.example .env - echo "⚠️ Please update your .env file with appropriate values, especially APP_KEY" -fi - -# Check if podman-compose is available -if ! command -v podman-compose &> /dev/null; then - echo "❌ podman-compose not found. Installing..." - pip3 install --user podman-compose - echo "✅ podman-compose installed" -fi - -# Start services -echo "🔧 Starting services..." -podman-compose -f docker/dev/podman/docker-compose.yml up -d - -# Wait for database to be ready -echo "⏳ Waiting for database to be ready..." -sleep 10 - -# Check if APP_KEY is set -if grep -q "APP_KEY=base64:YOUR_APP_KEY_HERE" .env || grep -q "APP_KEY=$" .env; then - echo "🔑 Generating application key..." - podman exec incr-dev-app php artisan key:generate -fi - -# Run migrations -echo "🗃️ Running database migrations..." -podman exec incr-dev-app php artisan migrate - -# Install/update dependencies if needed -echo "📦 Installing dependencies..." -podman exec incr-dev-app composer install -podman exec incr-dev-app npm install - -echo "✅ Development environment is ready!" -echo "🌐 Application: http://localhost:8000" -echo "🔥 Vite dev server: http://localhost:5173" -echo "💾 Database: localhost:3307" -echo "" -echo "To stop: podman-compose -f docker/dev/podman/docker-compose.yml down" -echo "To view logs: podman-compose -f docker/dev/podman/docker-compose.yml logs -f" \ No newline at end of file diff --git a/docker/production/Dockerfile b/docker/production/Dockerfile deleted file mode 100644 index 2cc673a..0000000 --- a/docker/production/Dockerfile +++ /dev/null @@ -1,81 +0,0 @@ -# Multi-stage build for Laravel + React application -FROM node:20-alpine AS frontend-builder - -WORKDIR /app - -# Copy package files -COPY package*.json ./ - -# Install Node dependencies -RUN npm ci --only=production - -# Copy frontend source -COPY resources/ resources/ -COPY public/ public/ -COPY vite.config.ts ./ -COPY tsconfig.json ./ -COPY components.json ./ -COPY eslint.config.js ./ - -# Build frontend assets -RUN npm run build - -# PHP runtime stage -FROM php:8.2-fpm-alpine - -# Install system dependencies -RUN apk add --no-cache \ - git \ - curl \ - libpng-dev \ - libxml2-dev \ - zip \ - unzip \ - oniguruma-dev \ - mysql-client \ - nginx \ - supervisor - -# Install PHP extensions -RUN docker-php-ext-install \ - pdo_mysql \ - mbstring \ - exif \ - pcntl \ - bcmath \ - gd - -# Install Composer -COPY --from=composer:latest /usr/bin/composer /usr/bin/composer - -# Set working directory -WORKDIR /var/www/html - -# Copy application code first -COPY . . - -# Install PHP dependencies after copying all files -RUN composer install --no-dev --optimize-autoloader --no-interaction - -# Copy built frontend assets from builder stage -COPY --from=frontend-builder /app/public/build/ ./public/build/ - -# Copy nginx and supervisor configurations -COPY docker/nginx.conf /etc/nginx/http.d/default.conf -COPY docker/supervisord.conf /etc/supervisord.conf -COPY docker/start-app.sh /usr/local/bin/start-app - -# Set proper permissions -RUN chown -R www-data:www-data storage bootstrap/cache public/build \ - && chmod -R 755 storage bootstrap/cache \ - && chmod +x /usr/local/bin/start-app - -# Expose port 80 for nginx -EXPOSE 80 - -# Health check -HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \ - CMD php artisan --version || exit 1 - -# Start the application -CMD ["/usr/local/bin/start-app"] diff --git a/docker/production/docker-compose.yml b/docker/production/docker-compose.yml deleted file mode 100644 index 7a4ed23..0000000 --- a/docker/production/docker-compose.yml +++ /dev/null @@ -1,58 +0,0 @@ -version: '3.8' - -services: - app: - image: codeberg.org/lvl0/incr:latest -# build: -# context: .. -# dockerfile: docker/Dockerfile - container_name: incr-app - restart: unless-stopped - working_dir: /var/www/html - environment: - - APP_ENV=production - - APP_DEBUG=false - - DB_CONNECTION=mysql - - DB_HOST=db - - DB_PORT=3306 - - DB_DATABASE=incr - - DB_USERNAME=incr_user - - DB_PASSWORD=incr_password - volumes: [] - ports: - - "5001:80" - depends_on: - db: - condition: service_healthy - networks: - - incr-network - - db: - image: docker.io/library/mysql:8.0 - container_name: incr-db - restart: unless-stopped - environment: - - MYSQL_DATABASE=incr - - MYSQL_USER=incr_user - - MYSQL_PASSWORD=incr_password - - MYSQL_ROOT_PASSWORD=root_password - volumes: - - db_data:/var/lib/mysql - ports: - - "3306:3306" - healthcheck: - test: ["CMD", "mysqladmin", "ping", "-h", "localhost", "-u", "incr_user", "-pincr_password"] - timeout: 10s - retries: 10 - interval: 10s - start_period: 10s - networks: - - incr-network - -networks: - incr-network: - driver: bridge - -volumes: - db_data: - driver: local diff --git a/docker/production/nginx.conf b/docker/production/nginx.conf deleted file mode 100644 index b462ad6..0000000 --- a/docker/production/nginx.conf +++ /dev/null @@ -1,26 +0,0 @@ -server { - listen 80; - server_name localhost; - root /var/www/html/public; - index index.php index.html; - - location / { - try_files $uri $uri/ /index.php?$query_string; - } - - location ~ \.php$ { - fastcgi_pass 127.0.0.1:9000; - fastcgi_index index.php; - fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name; - include fastcgi_params; - } - - location ~ /\.ht { - deny all; - } - - location ~* \.(css|js|png|jpg|jpeg|gif|ico|svg|woff|woff2|ttf|eot)$ { - expires 1y; - add_header Cache-Control "public, immutable"; - } -} \ No newline at end of file diff --git a/docker/production/start-app.sh b/docker/production/start-app.sh deleted file mode 100644 index d617f29..0000000 --- a/docker/production/start-app.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/sh - -# Copy public files to shared volume if needed -cp -r /var/www/html/public/. /var/www/html/public_shared/ 2>/dev/null || true - -# Create .env file if it doesn't exist -if [ ! -f /var/www/html/.env ]; then - cp /var/www/html/.env.example /var/www/html/.env 2>/dev/null || touch /var/www/html/.env -fi - -# Wait for database to be ready -echo "Waiting for database..." -until php artisan tinker --execute="DB::connection()->getPdo();" 2>/dev/null; do - echo "Database not ready, waiting..." - sleep 2 -done -echo "Database is ready!" - -# Generate app key if not set -php artisan key:generate --force - -# Laravel optimizations -php artisan config:cache -php artisan route:cache -php artisan view:cache -php artisan migrate --force - -# Start supervisor to manage nginx and php-fpm -supervisord -c /etc/supervisord.conf \ No newline at end of file diff --git a/docker/production/supervisord.conf b/docker/production/supervisord.conf deleted file mode 100644 index 8a7a5b6..0000000 --- a/docker/production/supervisord.conf +++ /dev/null @@ -1,21 +0,0 @@ -[supervisord] -nodaemon=true -user=root - -[program:nginx] -command=nginx -g "daemon off;" -autostart=true -autorestart=true -stdout_logfile=/dev/stdout -stdout_logfile_maxbytes=0 -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes=0 - -[program:php-fpm] -command=php-fpm --nodaemonize -autostart=true -autorestart=true -stdout_logfile=/dev/stdout -stdout_logfile_maxbytes=0 -stderr_logfile=/dev/stderr -stderr_logfile_maxbytes=0 \ No newline at end of file diff --git a/resources/css/app.css b/resources/css/app.css index 1760079..912a683 100644 --- a/resources/css/app.css +++ b/resources/css/app.css @@ -16,15 +16,6 @@ .font-digital { font-family: '7Segment', monospace; } -.glow-red { - box-shadow: 0 0 20px rgba(239, 68, 68, 0.4); - transition: box-shadow 300ms ease; -} - -.glow-red:hover { - box-shadow: 0 0 25px rgba(239, 68, 68, 0.6); -} - @custom-variant dark (&:is(.dark *)); @theme { diff --git a/resources/js/components/Assets/AssetSetupForm.tsx b/resources/js/components/Assets/AssetSetupForm.tsx deleted file mode 100644 index 315d72b..0000000 --- a/resources/js/components/Assets/AssetSetupForm.tsx +++ /dev/null @@ -1,156 +0,0 @@ -import { Button } from '@/components/ui/button'; -import { Input } from '@/components/ui/input'; -import { Label } from '@/components/ui/label'; -import InputError from '@/components/InputError'; -import { useForm } from '@inertiajs/react'; -import { LoaderCircle } from 'lucide-react'; -import { FormEventHandler, useState, useEffect } from 'react'; -import ComponentTitle from '@/components/ui/ComponentTitle'; - -interface AssetFormData { - symbol: string; - full_name: string; - [key: string]: string; -} - -interface AssetSetupFormProps { - onSuccess?: () => void; - onCancel?: () => void; -} - -export default function AssetSetupForm({ onSuccess, onCancel }: AssetSetupFormProps) { - const { data, setData, post, processing, errors } = useForm({ - symbol: '', - full_name: '', - }); - - // Load existing asset data on mount - useEffect(() => { - const fetchCurrentAsset = async () => { - try { - const response = await fetch('/assets/current'); - if (response.ok) { - const assetData = await response.json(); - if (assetData.asset) { - setData({ - symbol: assetData.asset.symbol || '', - full_name: assetData.asset.full_name || '', - }); - } - } - } catch (error) { - console.error('Failed to fetch current asset:', error); - } - }; - - fetchCurrentAsset(); - }, []); - - const [suggestions] = useState([ - { symbol: 'VWCE', full_name: 'Vanguard FTSE All-World UCITS ETF' }, - { symbol: 'VTI', full_name: 'Vanguard Total Stock Market ETF' }, - { symbol: 'SPY', full_name: 'SPDR S&P 500 ETF Trust' }, - { symbol: 'QQQ', full_name: 'Invesco QQQ Trust' }, - { symbol: 'IWDA', full_name: 'iShares Core MSCI World UCITS ETF' }, - ]); - - const submit: FormEventHandler = (e) => { - e.preventDefault(); - - post(route('assets.set-current'), { - onSuccess: () => { - if (onSuccess) onSuccess(); - }, - }); - }; - - const handleSuggestionClick = (suggestion: { symbol: string; full_name: string }) => { - setData({ - symbol: suggestion.symbol, - full_name: suggestion.full_name, - }); - }; - - return ( -
-
- SET ASSET -

- [SYSTEM] Specify the asset you want to track -

- - {/* Quick suggestions */} -
- -
- {suggestions.map((suggestion) => ( - - ))} -
-
- -
-
- - setData('symbol', e.target.value.toUpperCase())} - className="bg-black border-red-500 text-red-400 focus:border-red-300 font-mono text-sm rounded-none border-2 focus:ring-0 focus:outline-none focus:shadow-[0_0_10px_rgba(239,68,68,0.5)] placeholder:text-red-400/40 transition-all" - /> -

- [REQUIRED] ticker symbol (e.g. VWCE, VTI, SPY) -

- -
- -
- - setData('full_name', e.target.value)} - className="bg-black border-red-500 text-red-400 focus:border-red-300 font-mono text-sm rounded-none border-2 focus:ring-0 focus:outline-none focus:shadow-[0_0_10px_rgba(239,68,68,0.5)] placeholder:text-red-400/40 transition-all" - /> -

- [OPTIONAL] human-readable asset name -

- -
- -
- - {onCancel && ( - - )} -
-
-
-
- ); -} \ No newline at end of file diff --git a/resources/js/components/Display/InlineForm.tsx b/resources/js/components/Display/InlineForm.tsx index 7dd4ca8..9d6b693 100644 --- a/resources/js/components/Display/InlineForm.tsx +++ b/resources/js/components/Display/InlineForm.tsx @@ -2,7 +2,7 @@ import AddMilestoneForm from '@/components/Milestones/AddMilestoneForm'; import AddPurchaseForm from '@/components/Transactions/AddPurchaseForm'; import UpdatePriceForm from '@/components/Pricing/UpdatePriceForm'; import { cn } from '@/lib/utils'; -import ComponentTitle from '@/components/ui/ComponentTitle'; +import { X } from 'lucide-react'; interface InlineFormProps { type: 'purchase' | 'milestone' | 'price' | null; @@ -13,58 +13,66 @@ interface InlineFormProps { className?: string; } -export default function InlineForm({ - type, - onClose, +export default function InlineForm({ + type, + onClose, onPurchaseSuccess, onMilestoneSuccess, onPriceSuccess, - className + className }: InlineFormProps) { if (!type) return null; const title = type === 'purchase' ? 'ADD PURCHASE' : type === 'milestone' ? 'ADD MILESTONE' : 'UPDATE PRICE'; return ( -
{/* Header */} -
+
+

+ {title} +

+ +
- {/* Form Content */} -
- {type === 'purchase' ? ( - { - if (onPurchaseSuccess) onPurchaseSuccess(); - onClose(); - }} - onCancel={onClose} - /> - ) : type === 'milestone' ? ( - { - if (onMilestoneSuccess) onMilestoneSuccess(); - onClose(); - }} - onCancel={onClose} - /> - ) : ( - { - if (onPriceSuccess) onPriceSuccess(); - onClose(); - }} - onCancel={onClose} - /> - )} -
+ {/* Form Content */} +
+ {type === 'purchase' ? ( + { + if (onPurchaseSuccess) onPurchaseSuccess(); + onClose(); + }} + /> + ) : type === 'milestone' ? ( + { + if (onMilestoneSuccess) onMilestoneSuccess(); + onClose(); + }} + /> + ) : ( + { + if (onPriceSuccess) onPriceSuccess(); + onClose(); + }} + /> + )}
); -} +} \ No newline at end of file diff --git a/resources/js/components/Display/ProgressBar.tsx b/resources/js/components/Display/ProgressBar.tsx index 4343cb5..05fdf7e 100644 --- a/resources/js/components/Display/ProgressBar.tsx +++ b/resources/js/components/Display/ProgressBar.tsx @@ -43,7 +43,7 @@ export default function ProgressBar({ {/* Progress Bar Container */}
{/* Old-school progress bar with overlaid text */} -
+
{/* Inner container */}
{/* Progress fill */} diff --git a/resources/js/components/Display/StatsBox.tsx b/resources/js/components/Display/StatsBox.tsx index 4d5a59f..eafa4aa 100644 --- a/resources/js/components/Display/StatsBox.tsx +++ b/resources/js/components/Display/StatsBox.tsx @@ -1,7 +1,6 @@ import { cn } from '@/lib/utils'; import { Plus, ChevronRight } from 'lucide-react'; import { useState } from 'react'; -import ComponentTitle from '@/components/ui/ComponentTitle'; interface Milestone { target: number; @@ -70,11 +69,12 @@ export default function StatsBox({ className )} > -
+
{/* STATS Title and Current Price */}
- Stats - +

+ STATS +

{stats.currentPrice && (
@@ -185,8 +185,8 @@ export default function StatsBox({ key={index} className={cn( isSelectedMilestone - ? "bg-red-500 text-black" - : "text-red-500 font-bold" + ? "text-red-500 font-bold" + : "bg-red-500 text-black" )} > diff --git a/resources/js/components/Milestones/AddMilestoneForm.tsx b/resources/js/components/Milestones/AddMilestoneForm.tsx index 8433bf0..629831f 100644 --- a/resources/js/components/Milestones/AddMilestoneForm.tsx +++ b/resources/js/components/Milestones/AddMilestoneForm.tsx @@ -5,7 +5,6 @@ import InputError from '@/components/InputError'; import { useForm } from '@inertiajs/react'; import { LoaderCircle } from 'lucide-react'; import { FormEventHandler } from 'react'; -import ComponentTitle from '@/components/ui/ComponentTitle'; interface MilestoneFormData { target: string; @@ -15,10 +14,9 @@ interface MilestoneFormData { interface AddMilestoneFormProps { onSuccess?: () => void; - onCancel?: () => void; } -export default function AddMilestoneForm({ onSuccess, onCancel }: AddMilestoneFormProps) { +export default function AddMilestoneForm({ onSuccess }: AddMilestoneFormProps) { const { data, setData, post, processing, errors, reset } = useForm({ target: '', description: '', @@ -38,12 +36,11 @@ export default function AddMilestoneForm({ onSuccess, onCancel }: AddMilestoneFo }; return ( -
+
- ADD MILESTONE
- + setData('target', e.target.value)} - className="bg-black border-red-500 text-red-400 focus:border-red-300 font-mono text-sm rounded-none border-2 focus:ring-0 focus:outline-none placeholder:text-red-400/40 transition-all glow-red" + className="bg-black border-red-500/30 text-red-400 focus:border-red-400 placeholder:text-red-400/30" />
- + setData('description', e.target.value)} - className="bg-black border-red-500 text-red-400 focus:border-red-300 font-mono text-sm rounded-none border-2 focus:ring-0 focus:outline-none placeholder:text-red-400/40 transition-all glow-red" + className="bg-black border-red-500/30 text-red-400 focus:border-red-400 placeholder:text-red-400/30" />
-
- - {onCancel && ( - - )} -
+
); -} +} \ No newline at end of file diff --git a/resources/js/components/Onboarding/OnboardingFlow.tsx b/resources/js/components/Onboarding/OnboardingFlow.tsx deleted file mode 100644 index e80f825..0000000 --- a/resources/js/components/Onboarding/OnboardingFlow.tsx +++ /dev/null @@ -1,234 +0,0 @@ -import { useState, useEffect } from 'react'; -import AssetSetupForm from '@/components/Assets/AssetSetupForm'; -import AddPurchaseForm from '@/components/Transactions/AddPurchaseForm'; -import AddMilestoneForm from '@/components/Milestones/AddMilestoneForm'; -import UpdatePriceForm from '@/components/Pricing/UpdatePriceForm'; - -interface OnboardingStep { - id: string; - title: string; - description: string; - completed: boolean; - required: boolean; -} - -interface OnboardingFlowProps { - onComplete?: () => void; -} - -export default function OnboardingFlow({ onComplete }: OnboardingFlowProps) { - const [currentStep, setCurrentStep] = useState(0); - const [steps, setSteps] = useState([ - { - id: 'asset', - title: 'SET ASSET', - description: 'Choose the asset you want to track', - completed: false, - required: true, - }, - { - id: 'purchases', - title: 'ADD PURCHASES', - description: 'Enter your current holdings', - completed: false, - required: true, - }, - { - id: 'milestones', - title: 'SET MILESTONES', - description: 'Define your investment goals', - completed: false, - required: true, - }, - { - id: 'price', - title: 'CURRENT PRICE', - description: 'Set current asset price', - completed: false, - required: true, - }, - ]); - - // Check onboarding status on mount - useEffect(() => { - checkOnboardingStatus(); - }, []); - - const checkOnboardingStatus = async () => { - try { - // Check asset - const assetResponse = await fetch('/assets/current'); - const assetData = await assetResponse.json(); - const hasAsset = !!assetData.asset; - - // Check purchases - const purchaseResponse = await fetch('/purchases/summary'); - const purchaseData = await purchaseResponse.json(); - const hasPurchases = purchaseData.total_shares > 0; - - // Check milestones - const milestonesResponse = await fetch('/milestones'); - const milestonesData = await milestonesResponse.json(); - const hasMilestones = milestonesData.length > 0; - - // Check current price - const priceResponse = await fetch('/pricing/current'); - const priceData = await priceResponse.json(); - const hasPrice = !!priceData.current_price; - - setSteps(prev => prev.map(step => ({ - ...step, - completed: - (step.id === 'asset' && hasAsset) || - (step.id === 'purchases' && hasPurchases) || - (step.id === 'milestones' && hasMilestones) || - (step.id === 'price' && hasPrice) - }))); - - // Find first incomplete required step - const firstIncompleteStep = steps.findIndex(step => - step.required && !step.completed - ); - - if (firstIncompleteStep !== -1) { - setCurrentStep(firstIncompleteStep); - } else { - // All required steps complete, check if we should call onComplete - const allRequiredComplete = steps.filter(s => s.required).every(s => s.completed); - if (allRequiredComplete && onComplete) { - onComplete(); - } - } - } catch (error) { - console.error('Failed to check onboarding status:', error); - } - }; - - const handleStepComplete = async () => { - // Mark current step as completed - setSteps(prev => prev.map((step, index) => - index === currentStep ? { ...step, completed: true } : step - )); - - // Refresh onboarding status - await checkOnboardingStatus(); - - // Move to next incomplete step or complete onboarding - const nextIncompleteStep = steps.findIndex((step, index) => - index > currentStep && step.required && !step.completed - ); - - if (nextIncompleteStep !== -1) { - setCurrentStep(nextIncompleteStep); - } else { - // All required steps complete - const allRequiredComplete = steps.filter(s => s.required).every(s => s.completed); - if (allRequiredComplete && onComplete) { - onComplete(); - } - } - }; - - const handleStepSelect = (stepIndex: number) => { - setCurrentStep(stepIndex); - }; - - const renderStepContent = () => { - const step = steps[currentStep]; - - switch (step.id) { - case 'asset': - return ( - - ); - case 'purchases': - return ( - - ); - case 'milestones': - return ( - - ); - case 'price': - return ( - - ); - default: - return null; - } - }; - - return ( -
-
- {/* Terminal-style border with red glow */} -
- {/* Header */} -
-

- [SYSTEM] ONBOARDING SEQUENCE -

-

- Initialize your asset tracking system -

-
- - {/* Progress indicator */} -
-
- {steps.map((step, index) => ( - - ))} -
- -
-

- {steps[currentStep].description} -

-

- STEP {currentStep + 1}/{steps.length} -

-
-
- - {/* Step content */} -
- {renderStepContent()} -
- - {/* Status footer */} -
-
-

- [STATUS] {steps.filter(s => s.completed).length}/{steps.length} STEPS COMPLETE -

-

- {steps.filter(s => s.required && !s.completed).length} REQUIRED REMAINING -

-
-
-
-
-
- ); -} \ No newline at end of file diff --git a/resources/js/components/Pricing/UpdatePriceForm.tsx b/resources/js/components/Pricing/UpdatePriceForm.tsx index 8a99c2b..bd18cb9 100644 --- a/resources/js/components/Pricing/UpdatePriceForm.tsx +++ b/resources/js/components/Pricing/UpdatePriceForm.tsx @@ -1,11 +1,11 @@ import { Button } from '@/components/ui/button'; +import { Card, CardContent, CardHeader, CardTitle } from '@/components/ui/card'; import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; import InputError from '@/components/InputError'; import { useForm } from '@inertiajs/react'; import { LoaderCircle } from 'lucide-react'; import { FormEventHandler } from 'react'; -import ComponentTitle from '@/components/ui/ComponentTitle'; interface PriceUpdateFormData { date: string; @@ -17,13 +17,12 @@ interface UpdatePriceFormProps { currentPrice?: number; className?: string; onSuccess?: () => void; - onCancel?: () => void; } -export default function UpdatePriceForm({ currentPrice, className, onSuccess, onCancel }: UpdatePriceFormProps) { +export default function UpdatePriceForm({ currentPrice, className, onSuccess }: UpdatePriceFormProps) { const { data, setData, post, processing, errors } = useForm({ date: new Date().toISOString().split('T')[0], // Today's date in YYYY-MM-DD format - price: currentPrice?.toString() || '100.00', + price: currentPrice?.toString() || '', }); const submit: FormEventHandler = (e) => { @@ -33,41 +32,37 @@ export default function UpdatePriceForm({ currentPrice, className, onSuccess, on onSuccess: () => { // Keep the date, reset only price if needed // User might want to update same day multiple times - if (onSuccess) { - onSuccess(); - } + if (onSuccess) onSuccess(); }, - onError: (errors) => { - console.error('Price update failed:', errors); - } }); }; return ( -
-
- UPDATE PRICE + + + Update Asset Price {currentPrice && ( -

- [CURRENT] €{currentPrice.toFixed(4)} +

+ Current price: €{currentPrice.toFixed(4)}

)} +
+
- + setData('date', e.target.value)} max={new Date().toISOString().split('T')[0]} - className="bg-black border-red-500 text-red-400 focus:border-red-300 font-mono text-sm rounded-none border-2 focus:ring-0 focus:outline-none transition-all glow-red" />
- + setData('price', e.target.value)} - className="bg-black border-red-500 text-red-400 focus:border-red-300 font-mono text-sm rounded-none border-2 focus:ring-0 focus:outline-none focus:shadow-[0_0_10px_rgba(239,68,68,0.5)] placeholder:text-red-400/40 transition-all" /> -

- [UNIT] price per share +

+ Price per unit/share of the asset

-
- - {onCancel && ( - - )} -
+
-
-
+ + ); } diff --git a/resources/js/components/Transactions/AddPurchaseForm.tsx b/resources/js/components/Transactions/AddPurchaseForm.tsx index 94c254b..68732b2 100644 --- a/resources/js/components/Transactions/AddPurchaseForm.tsx +++ b/resources/js/components/Transactions/AddPurchaseForm.tsx @@ -4,8 +4,7 @@ import { Label } from '@/components/ui/label'; import InputError from '@/components/InputError'; import { useForm } from '@inertiajs/react'; import { LoaderCircle } from 'lucide-react'; -import { FormEventHandler, useEffect, useState } from 'react'; -import ComponentTitle from '@/components/ui/ComponentTitle'; +import { FormEventHandler, useEffect } from 'react'; interface PurchaseFormData { date: string; @@ -17,16 +16,9 @@ interface PurchaseFormData { interface AddPurchaseFormProps { onSuccess?: () => void; - onCancel?: () => void; } -interface PurchaseSummary { - total_shares: number; - total_investment: number; - average_cost_per_share: number; -} - -export default function AddPurchaseForm({ onSuccess, onCancel }: AddPurchaseFormProps) { +export default function AddPurchaseForm({ onSuccess }: AddPurchaseFormProps) { const { data, setData, post, processing, errors, reset } = useForm({ date: new Date().toISOString().split('T')[0], // Today's date in YYYY-MM-DD format shares: '', @@ -34,31 +26,12 @@ export default function AddPurchaseForm({ onSuccess, onCancel }: AddPurchaseForm total_cost: '', }); - const [currentHoldings, setCurrentHoldings] = useState(null); - - // Load existing holdings data on mount - useEffect(() => { - const fetchCurrentHoldings = async () => { - try { - const response = await fetch('/purchases/summary'); - if (response.ok) { - const summary = await response.json(); - setCurrentHoldings(summary); - } - } catch (error) { - console.error('Failed to fetch current holdings:', error); - } - }; - - fetchCurrentHoldings(); - }, []); - // Auto-calculate total cost when shares or price changes useEffect(() => { if (data.shares && data.price_per_share) { const shares = parseFloat(data.shares); const pricePerShare = parseFloat(data.price_per_share); - + if (!isNaN(shares) && !isNaN(pricePerShare)) { const totalCost = (shares * pricePerShare).toFixed(2); setData('total_cost', totalCost); @@ -81,30 +54,24 @@ export default function AddPurchaseForm({ onSuccess, onCancel }: AddPurchaseForm }; return ( -
+
- ADD PURCHASE - {currentHoldings && currentHoldings.total_shares > 0 && ( -

- [CURRENT] {currentHoldings.total_shares.toFixed(6)} shares • €{currentHoldings.total_investment.toFixed(2)} invested -

- )}
- + setData('date', e.target.value)} max={new Date().toISOString().split('T')[0]} - className="bg-black border-red-500 text-red-400 focus:border-red-300 font-mono text-sm rounded-none border-2 focus:ring-0 focus:outline-none transition-all glow-red" + className="bg-black border-red-500/30 text-red-400 focus:border-red-400" />
- + setData('shares', e.target.value)} - className="bg-black border-red-500 text-red-400 focus:border-red-300 font-mono text-sm rounded-none border-2 focus:ring-0 focus:outline-none placeholder:text-red-400/40 transition-all glow-red" + className="bg-black border-red-500/30 text-red-400 focus:border-red-400 placeholder:text-red-400/30" />
- + setData('price_per_share', e.target.value)} - className="bg-black border-red-500 text-red-400 focus:border-red-300 font-mono text-sm rounded-none border-2 focus:ring-0 focus:outline-none placeholder:text-red-400/40 transition-all glow-red" + className="bg-black border-red-500/30 text-red-400 focus:border-red-400 placeholder:text-red-400/30" />
- + setData('total_cost', e.target.value)} - className="bg-black border-red-500 text-red-400 focus:border-red-300 font-mono text-sm rounded-none border-2 focus:ring-0 focus:outline-none placeholder:text-red-400/40 transition-all glow-red" + className="bg-black border-red-500/30 text-red-400 focus:border-red-400 placeholder:text-red-400/30" /> -

- [AUTO-CALC] shares × price +

+ Auto-calculated from shares × price

-
- - {onCancel && ( - - )} -
+
); -} +} \ No newline at end of file diff --git a/resources/js/components/ui/ComponentTitle.tsx b/resources/js/components/ui/ComponentTitle.tsx deleted file mode 100644 index 7c39a62..0000000 --- a/resources/js/components/ui/ComponentTitle.tsx +++ /dev/null @@ -1,15 +0,0 @@ -import { FC, ReactNode } from 'react'; - -interface ComponentTitleProps { - children: ReactNode; -} - -const ComponentTitle: FC = ({ children }) => { - return ( -

- { children } -

- ) -} - -export default ComponentTitle diff --git a/resources/js/components/ui/TerminalSpinner.tsx b/resources/js/components/ui/TerminalSpinner.tsx deleted file mode 100644 index 98c5169..0000000 --- a/resources/js/components/ui/TerminalSpinner.tsx +++ /dev/null @@ -1,57 +0,0 @@ -import { useEffect, useState } from 'react'; - -interface TerminalSpinnerProps { - text?: string; - size?: 'sm' | 'md' | 'lg'; - fullScreen?: boolean; -} - -export default function TerminalSpinner({ - text = 'LOADING', - size = 'md', - fullScreen = false -}: TerminalSpinnerProps) { - const [dots, setDots] = useState(0); - - useEffect(() => { - const interval = setInterval(() => { - setDots(prev => (prev + 1) % 4); - }, 500); - - return () => clearInterval(interval); - }, []); - - const getDots = () => { - switch (dots) { - case 0: return ' '; - case 1: return '. '; - case 2: return '.. '; - case 3: return '...'; - default: return ' '; - } - }; - - const sizeClasses = { - sm: 'text-sm', - md: 'text-lg', - lg: 'text-xl' - }; - - const spinner = ( -
- - [SYSTEM] {text}{getDots()} - -
- ); - - if (fullScreen) { - return ( -
- {spinner} -
- ); - } - - return spinner; -} \ No newline at end of file diff --git a/resources/js/pages/dashboard.tsx b/resources/js/pages/dashboard.tsx index 3abea13..6753014 100644 --- a/resources/js/pages/dashboard.tsx +++ b/resources/js/pages/dashboard.tsx @@ -2,8 +2,6 @@ import LedDisplay from '@/components/Display/LedDisplay'; import InlineForm from '@/components/Display/InlineForm'; import ProgressBar from '@/components/Display/ProgressBar'; import StatsBox from '@/components/Display/StatsBox'; -import OnboardingFlow from '@/components/Onboarding/OnboardingFlow'; -import TerminalSpinner from '@/components/ui/TerminalSpinner'; import { Head } from '@inertiajs/react'; import { useEffect, useState } from 'react'; @@ -29,29 +27,26 @@ export default function Dashboard() { total_investment: 0, average_cost_per_share: 0, }); - + const [priceData, setPriceData] = useState({ current_price: null, }); - + const [milestones, setMilestones] = useState([]); const [selectedMilestoneIndex, setSelectedMilestoneIndex] = useState(0); const [showProgressBar, setShowProgressBar] = useState(false); const [showStatsBox, setShowStatsBox] = useState(false); const [activeForm, setActiveForm] = useState<'purchase' | 'milestone' | 'price' | null>(null); const [loading, setLoading] = useState(true); - const [needsOnboarding, setNeedsOnboarding] = useState(false); - const [currentAsset, setCurrentAsset] = useState(null); - // Fetch purchase summary, current price, milestones, and check onboarding + // Fetch purchase summary, current price, and milestones useEffect(() => { const fetchData = async () => { try { - const [purchaseResponse, priceResponse, milestonesResponse, assetResponse] = await Promise.all([ + const [purchaseResponse, priceResponse, milestonesResponse] = await Promise.all([ fetch('/purchases/summary'), fetch('/pricing/current'), fetch('/milestones'), - fetch('/assets/current'), ]); if (purchaseResponse.ok) { @@ -68,14 +63,6 @@ export default function Dashboard() { const milestonesData = await milestonesResponse.json(); setMilestones(milestonesData); } - - if (assetResponse.ok) { - const assetData = await assetResponse.json(); - setCurrentAsset(assetData.asset); - } - - // Check if onboarding is needed after all data is loaded - await checkOnboardingStatus(); } catch (error) { console.error('Failed to fetch data:', error); } finally { @@ -86,33 +73,6 @@ export default function Dashboard() { fetchData(); }, []); - // Check if user needs onboarding - const checkOnboardingStatus = async () => { - try { - const [assetResponse, purchaseResponse, milestonesResponse] = await Promise.all([ - fetch('/assets/current'), - fetch('/purchases/summary'), - fetch('/milestones'), - ]); - - const assetData = await assetResponse.json(); - const purchaseData = await purchaseResponse.json(); - const milestonesData = await milestonesResponse.json(); - - const hasAsset = !!assetData.asset; - const hasPurchases = purchaseData.total_shares > 0; - const hasMilestones = milestonesData.length > 0; - - // User needs onboarding if any required step is missing - const needsOnboarding = !hasAsset || !hasPurchases || !hasMilestones; - setNeedsOnboarding(needsOnboarding); - } catch (error) { - console.error('Failed to check onboarding status:', error); - // If we can't check, assume onboarding is needed - setNeedsOnboarding(true); - } - }; - // Refresh data after successful purchase const handlePurchaseSuccess = async () => { try { @@ -161,14 +121,14 @@ export default function Dashboard() { // Calculate portfolio stats - const currentValue = priceData.current_price - ? purchaseData.total_shares * priceData.current_price + const currentValue = priceData.current_price + ? purchaseData.total_shares * priceData.current_price : undefined; - - const profitLoss = currentValue - ? currentValue - purchaseData.total_investment + + const profitLoss = currentValue + ? currentValue - purchaseData.total_investment : undefined; - + const profitLossPercentage = profitLoss && purchaseData.total_investment > 0 ? (profitLoss / purchaseData.total_investment) * 100 : undefined; @@ -187,7 +147,11 @@ export default function Dashboard() { return ( <> - +
+
+ LOADING... +
+
); } @@ -204,81 +168,36 @@ export default function Dashboard() { const handleProgressClick = () => { setShowStatsBox(!showStatsBox); - setActiveForm(null) }; - // Handle onboarding completion - const handleOnboardingComplete = async () => { - // Refresh all data and check onboarding status - await checkOnboardingStatus(); - - // Refresh individual data sets - const [purchaseResponse, priceResponse, milestonesResponse, assetResponse] = await Promise.all([ - fetch('/purchases/summary'), - fetch('/pricing/current'), - fetch('/milestones'), - fetch('/assets/current'), - ]); - - if (purchaseResponse.ok) { - const purchases = await purchaseResponse.json(); - setPurchaseData(purchases); - } - - if (priceResponse.ok) { - const price = await priceResponse.json(); - setPriceData(price); - } - - if (milestonesResponse.ok) { - const milestonesData = await milestonesResponse.json(); - setMilestones(milestonesData); - } - - if (assetResponse.ok) { - const assetData = await assetResponse.json(); - setCurrentAsset(assetData.asset); - } - }; - - // Show onboarding if needed - if (needsOnboarding) { - return ( - <> - - - - ); - } - return ( <> - + {/* Stacked Layout */}
{/* Box 1: LED Number Display - Fixed position from top */}
-
- + {/* Box 2: Progress Bar (toggleable) */} -
- +
- + {/* Box 3: Stats Box (toggleable) */} -
- + setActiveForm('price')} />
- + {/* Box 4: Forms (only when active form is set) */} -
+
setActiveForm(null)} diff --git a/routes/web.php b/routes/web.php index 9cb1e25..3ee6392 100644 --- a/routes/web.php +++ b/routes/web.php @@ -1,6 +1,5 @@ name('dashboard'); -// Asset routes -Route::prefix('assets')->name('assets.')->group(function () { - Route::get('/', [AssetController::class, 'index'])->name('index'); - Route::post('/', [AssetController::class, 'store'])->name('store'); - Route::get('/current', [AssetController::class, 'current'])->name('current'); - Route::post('/set-current', [AssetController::class, 'setCurrent'])->name('set-current'); - Route::get('/search', [AssetController::class, 'search'])->name('search'); - Route::get('/{asset}', [AssetController::class, 'show'])->name('show'); -}); - // Purchase routes Route::prefix('purchases')->name('purchases.')->group(function () { Route::get('/', [PurchaseController::class, 'index'])->name('index');